Upload model
Browse files- model.safetensors +1 -1
- modeling_test.py +23 -23
model.safetensors
CHANGED
|
@@ -1,3 +1,3 @@
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
-
oid sha256:
|
| 3 |
size 876042724
|
|
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:d1349aa18008de4bbf6906e998320035af0d3f8f160228bb3ce19251e986acf4
|
| 3 |
size 876042724
|
modeling_test.py
CHANGED
|
@@ -1,23 +1,23 @@
|
|
| 1 |
-
from transformers import PreTrainedModel
|
| 2 |
-
from .configuration_test import TestConfig
|
| 3 |
-
import torch.nn as nn
|
| 4 |
-
from transformers import AutoModelForMaskedLM, AutoConfig
|
| 5 |
-
from transformers import AutoModelForSequenceClassification
|
| 6 |
-
|
| 7 |
-
|
| 8 |
-
class TestModel(PreTrainedModel):
|
| 9 |
-
config_class = TestConfig
|
| 10 |
-
|
| 11 |
-
def __init__(self, config: TestConfig):
|
| 12 |
-
super().__init__(config)
|
| 13 |
-
self.input_dim = config.input_dim
|
| 14 |
-
self.model1 = nn.Linear(config.input_dim, config.output_dim)
|
| 15 |
-
self.model2 = AutoModelForMaskedLM.from_config(
|
| 16 |
-
AutoConfig.from_pretrained("bert-base-uncased")
|
| 17 |
-
)
|
| 18 |
-
self.model3 = AutoModelForSequenceClassification.from_config(
|
| 19 |
-
AutoConfig.from_pretrained("google-bert/bert-base-uncased", num_labels=2)
|
| 20 |
-
)
|
| 21 |
-
|
| 22 |
-
def forward(self, tensor):
|
| 23 |
-
return self.model1(tensor)
|
|
|
|
| 1 |
+
from transformers import PreTrainedModel
|
| 2 |
+
from .configuration_test import TestConfig
|
| 3 |
+
import torch.nn as nn
|
| 4 |
+
from transformers import AutoModelForMaskedLM, AutoConfig
|
| 5 |
+
from transformers import AutoModelForSequenceClassification
|
| 6 |
+
|
| 7 |
+
|
| 8 |
+
class TestModel(PreTrainedModel):
|
| 9 |
+
config_class = TestConfig
|
| 10 |
+
|
| 11 |
+
def __init__(self, config: TestConfig):
|
| 12 |
+
super().__init__(config)
|
| 13 |
+
self.input_dim = config.input_dim
|
| 14 |
+
self.model1 = nn.Linear(config.input_dim, config.output_dim)
|
| 15 |
+
self.model2 = AutoModelForMaskedLM.from_config(
|
| 16 |
+
AutoConfig.from_pretrained("bert-base-uncased")
|
| 17 |
+
)
|
| 18 |
+
self.model3 = AutoModelForSequenceClassification.from_config(
|
| 19 |
+
AutoConfig.from_pretrained("google-bert/bert-base-uncased", num_labels=2)
|
| 20 |
+
)
|
| 21 |
+
|
| 22 |
+
def forward(self, tensor):
|
| 23 |
+
return self.model1(tensor)
|