Commit
·
846853f
1
Parent(s):
e61ab3d
update
Browse files
config.json → saved/config.json
RENAMED
|
File without changes
|
saved/model.py
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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)
|
{pytorch_model.bin → saved}/model.safetensors
RENAMED
|
@@ -1,3 +1,3 @@
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
-
oid sha256:
|
| 3 |
size 496
|
|
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:6129e117260ef9958a341f3a738c069b1dbdde687e29b8de423475dd5c3e631b
|
| 3 |
size 496
|