Commit
·
e61ab3d
1
Parent(s):
f35de06
update
Browse files
pytorch_model.bin/config.json → config.json
RENAMED
|
File without changes
|
pytorch_model.bin/model.py
DELETED
|
@@ -1,21 +0,0 @@
|
|
| 1 |
-
from transformers import PreTrainedModel, PretrainedConfig
|
| 2 |
-
from torch import nn
|
| 3 |
-
|
| 4 |
-
class TestConfig(PretrainedConfig):
|
| 5 |
-
model_type = "test-model"
|
| 6 |
-
|
| 7 |
-
def __init__(self, input_dim=4, output_dim=16, **kwargs):
|
| 8 |
-
self.input_dim = input_dim
|
| 9 |
-
self.output_dim = output_dim
|
| 10 |
-
super().__init__(**kwargs)
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
class TestModel(PreTrainedModel):
|
| 14 |
-
config_class = TestConfig
|
| 15 |
-
|
| 16 |
-
def __init__(self, config):
|
| 17 |
-
super().__init__(config)
|
| 18 |
-
self.layer = nn.Linear(config.input_dim, config.output_dim)
|
| 19 |
-
|
| 20 |
-
def forward(self, input):
|
| 21 |
-
return self.layer(input)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|