Commit
·
f35de06
1
Parent(s):
162ee38
update
Browse files- config.json/config.json +0 -9
- config.json/model.py +0 -21
config.json/config.json
DELETED
|
@@ -1,9 +0,0 @@
|
|
| 1 |
-
{
|
| 2 |
-
"auto_map": {
|
| 3 |
-
"AutoConfig": "model.TestConfig"
|
| 4 |
-
},
|
| 5 |
-
"input_dim": 4,
|
| 6 |
-
"model_type": "test-model",
|
| 7 |
-
"output_dim": 16,
|
| 8 |
-
"transformers_version": "4.54.1"
|
| 9 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
config.json/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)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|