Update modeling_paragram_sp.py
Browse files- 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
|
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)
|