jwieting commited on
Commit
82026f0
1 Parent(s): 5d4de09

Update modeling_paragram_sp.py

Browse files
Files changed (1) hide show
  1. modeling_paragram_sp.py +1 -1
modeling_paragram_sp.py CHANGED
@@ -28,7 +28,7 @@ class ParagramSPModel(BertPreTrainedModel):
28
  print(input_ids)
29
  print(attention_mask)
30
  input_ids = self.filter_input_ids(input_ids)
31
- attention_mask = input_ids > 0
32
  embeddings = self.word_embeddings(input_ids)
33
  masked_embeddings = embeddings * attention_mask[:, :, None]
34
  mean_pooled_embeddings = masked_embeddings.sum(dim=1) / attention_mask[:, :, None].sum(dim=1)
 
28
  print(input_ids)
29
  print(attention_mask)
30
  input_ids = self.filter_input_ids(input_ids)
31
+ attention_mask = input_ids != self.config.pad_token_id
32
  embeddings = self.word_embeddings(input_ids)
33
  masked_embeddings = embeddings * attention_mask[:, :, None]
34
  mean_pooled_embeddings = masked_embeddings.sum(dim=1) / attention_mask[:, :, None].sum(dim=1)