paraphrastic_test / modeling_sim.py
jwieting's picture
Update modeling_sim.py
0ae896e
raw
history blame
667 Bytes
import torch
from torch import nn
from transformers import MobileBertPreTrainedModel, MobileBertModel
class SimModel(MobileBertPreTrainedModel):
def __init__(self, config):
super().__init__(config)
self.config = config
self.encoder = MobileBertModel(config)
# Initialize weights and apply final processing
self.post_init()
def forward(self, input_ids, attention_mask, token_type_ids, return_dict):
print(input_ids, attention_mask, token_type_ids)
print(return_dict)
return self.encoder(input_ids=input_ids, attention_mask=attention_mask, token_type_ids=token_type_ids, return_dict=return_dict)