Update modeling_me2bert.py
Browse files- modeling_me2bert.py +4 -5
modeling_me2bert.py
CHANGED
|
@@ -1,9 +1,8 @@
|
|
| 1 |
-
from transformers import PretrainedConfig
|
| 2 |
from transformers import PreTrainedModel
|
| 3 |
from transformers import AutoModel
|
| 4 |
import torch
|
| 5 |
from torch.autograd import Function
|
| 6 |
-
|
| 7 |
|
| 8 |
class ReverseLayerF(Function):
|
| 9 |
|
|
@@ -30,8 +29,8 @@ class FFClassifier(torch.nn.Module):
|
|
| 30 |
torch.nn.BatchNorm1d(hidden_dim), torch.nn.ReLU(True),
|
| 31 |
torch.nn.Dropout(dropout), torch.nn.Linear(hidden_dim, n_classes))
|
| 32 |
|
| 33 |
-
def forward(self,
|
| 34 |
-
return self.model(
|
| 35 |
|
| 36 |
|
| 37 |
class Encoder(torch.nn.Module):
|
|
@@ -102,7 +101,7 @@ class GatedCombination(torch.nn.Module):
|
|
| 102 |
|
| 103 |
class ME2BertModel(PreTrainedModel):
|
| 104 |
config_class = ME2BertConfig
|
| 105 |
-
|
| 106 |
def __init__(
|
| 107 |
self,
|
| 108 |
config: ME2BertConfig = None):
|
|
|
|
|
|
|
| 1 |
from transformers import PreTrainedModel
|
| 2 |
from transformers import AutoModel
|
| 3 |
import torch
|
| 4 |
from torch.autograd import Function
|
| 5 |
+
from .configuration_me2bert import ME2BertConfig
|
| 6 |
|
| 7 |
class ReverseLayerF(Function):
|
| 8 |
|
|
|
|
| 29 |
torch.nn.BatchNorm1d(hidden_dim), torch.nn.ReLU(True),
|
| 30 |
torch.nn.Dropout(dropout), torch.nn.Linear(hidden_dim, n_classes))
|
| 31 |
|
| 32 |
+
def forward(self, x):
|
| 33 |
+
return self.model(x)
|
| 34 |
|
| 35 |
|
| 36 |
class Encoder(torch.nn.Module):
|
|
|
|
| 101 |
|
| 102 |
class ME2BertModel(PreTrainedModel):
|
| 103 |
config_class = ME2BertConfig
|
| 104 |
+
base_model_prefix = "me2bert"
|
| 105 |
def __init__(
|
| 106 |
self,
|
| 107 |
config: ME2BertConfig = None):
|