Update model.py
Browse files
model.py
CHANGED
@@ -1,8 +1,10 @@
|
|
1 |
from transformers import BertModel, BertConfig
|
|
|
2 |
from transformers.modeling_outputs import BaseModelOutputWithPooling
|
3 |
import torch.nn as nn
|
4 |
import torch.nn.functional as F
|
5 |
-
from transformers import
|
|
|
6 |
from transformers import PretrainedConfig
|
7 |
|
8 |
class BertLSTMConfig(PretrainedConfig):
|
@@ -31,7 +33,7 @@ class BertLSTMConfig(PretrainedConfig):
|
|
31 |
}
|
32 |
|
33 |
|
34 |
-
class BertLSTMForSequenceClassification(PreTrainedModel):
|
35 |
config_class = BertLSTMConfig
|
36 |
|
37 |
def __init__(self, config):
|
|
|
1 |
from transformers import BertModel, BertConfig
|
2 |
+
from abc import ABCMeta
|
3 |
from transformers.modeling_outputs import BaseModelOutputWithPooling
|
4 |
import torch.nn as nn
|
5 |
import torch.nn.functional as F
|
6 |
+
from transformers.modeling_outputs import SequenceClassifierOutput
|
7 |
+
from transformers import PreTrainedModelt
|
8 |
from transformers import PretrainedConfig
|
9 |
|
10 |
class BertLSTMConfig(PretrainedConfig):
|
|
|
33 |
}
|
34 |
|
35 |
|
36 |
+
class BertLSTMForSequenceClassification(PreTrainedModel,, metaclass=ABCMeta):
|
37 |
config_class = BertLSTMConfig
|
38 |
|
39 |
def __init__(self, config):
|