Commit
·
6b2c7e9
1
Parent(s):
9634020
update
Browse files- config.json +4 -2
- custom_model.py +0 -4
config.json
CHANGED
|
@@ -1,3 +1,5 @@
|
|
| 1 |
{
|
| 2 |
-
|
| 3 |
-
|
|
|
|
|
|
|
|
|
| 1 |
{
|
| 2 |
+
"hidden_size": 128,
|
| 3 |
+
"model_type": "custom-model",
|
| 4 |
+
"transformers_version": "4.44.2"
|
| 5 |
+
}
|
custom_model.py
CHANGED
|
@@ -1,6 +1,5 @@
|
|
| 1 |
# custom_model.py
|
| 2 |
from transformers import PreTrainedModel, PretrainedConfig, AutoConfig, AutoModel
|
| 3 |
-
import torch
|
| 4 |
import torch.nn as nn
|
| 5 |
|
| 6 |
class CustomModelConfig(PretrainedConfig):
|
|
@@ -19,6 +18,3 @@ class CustomModel(PreTrainedModel):
|
|
| 19 |
def forward(self, input_ids):
|
| 20 |
output = self.linear(input_ids)
|
| 21 |
return output
|
| 22 |
-
|
| 23 |
-
AutoConfig.register("custom-model", CustomModelConfig)
|
| 24 |
-
AutoModel.register(CustomModelConfig, CustomModel)
|
|
|
|
| 1 |
# custom_model.py
|
| 2 |
from transformers import PreTrainedModel, PretrainedConfig, AutoConfig, AutoModel
|
|
|
|
| 3 |
import torch.nn as nn
|
| 4 |
|
| 5 |
class CustomModelConfig(PretrainedConfig):
|
|
|
|
| 18 |
def forward(self, input_ids):
|
| 19 |
output = self.linear(input_ids)
|
| 20 |
return output
|
|
|
|
|
|
|
|
|