Update modeling_sim.py
Browse files- modeling_sim.py +1 -0
modeling_sim.py
CHANGED
|
@@ -12,6 +12,7 @@ class SimModel(MobileBertPreTrainedModel):
|
|
| 12 |
|
| 13 |
def forward(self, input_ids, attention_mask, return_dict):
|
| 14 |
print(input_ids)
|
|
|
|
| 15 |
embeddings = self.word_embeddings(input_ids)
|
| 16 |
masked_embeddings = embeddings * attention_mask[:, :, None]
|
| 17 |
mean_pooled_embeddings = masked_embeddings.sum(dim=1) / attention_mask[:, :, None].sum(dim=1)
|
|
|
|
| 12 |
|
| 13 |
def forward(self, input_ids, attention_mask, return_dict):
|
| 14 |
print(input_ids)
|
| 15 |
+
print(attention_mask)
|
| 16 |
embeddings = self.word_embeddings(input_ids)
|
| 17 |
masked_embeddings = embeddings * attention_mask[:, :, None]
|
| 18 |
mean_pooled_embeddings = masked_embeddings.sum(dim=1) / attention_mask[:, :, None].sum(dim=1)
|