Nick Sorros
commited on
Commit
·
26d4cd1
1
Parent(s):
44b4eae
Make model compatible with output of tokenizer
Browse files
model.py
CHANGED
@@ -42,9 +42,10 @@ class BertMesh(PreTrainedModel):
|
|
42 |
self.linear_out = torch.nn.Linear(hidden_size, num_labels)
|
43 |
self.dropout_layer = torch.nn.Dropout(self.dropout)
|
44 |
|
45 |
-
def forward(self,
|
|
|
46 |
if self.multilabel_attention:
|
47 |
-
hidden_states = self.bert(input_ids=
|
48 |
attention_outs = self.multilabel_attention_layer(hidden_states)
|
49 |
outs = torch.nn.functional.relu(self.linear_1(attention_outs))
|
50 |
outs = self.dropout_layer(outs)
|
|
|
42 |
self.linear_out = torch.nn.Linear(hidden_size, num_labels)
|
43 |
self.dropout_layer = torch.nn.Dropout(self.dropout)
|
44 |
|
45 |
+
def forward(self, input_ids, token_type_ids=None, attention_mask=None):
|
46 |
+
input_ids = torch.tensor(input_ids)
|
47 |
if self.multilabel_attention:
|
48 |
+
hidden_states = self.bert(input_ids=input_ids)[0]
|
49 |
attention_outs = self.multilabel_attention_layer(hidden_states)
|
50 |
outs = torch.nn.functional.relu(self.linear_1(attention_outs))
|
51 |
outs = self.dropout_layer(outs)
|