Hey guys, I’m working on a multioutput classification task.
Can I place my target variable inside the forward function in the data model class i.e in this case
class BERTModel(nn.Module):
def init(self):
super(BERTModel, self).init()
self.bert = BertModel.from_pretrained(‘bert-base-uncased’, return_dict=True)
self.dropout = nn.Dropout(0.3)
self.classified = nn.Linear(768, 6)
def forward(self, ids, mask, token_type_ids, target):
_, pooled_output = self.bert(
input_ids = ids,
attention_mask = mask,
token_type_ids = token_type_ids,
target = target
)
pooled_output = self.dropout(pooled_output)
outputs = self.classified(pooled_output)
return outputs