brownfortress
commited on
Commit
•
5373bac
1
Parent(s):
05f841b
add model
Browse files- amc.py +1 -7
- config.json +5 -2
- pytorch_model.bin +2 -2
amc.py
CHANGED
@@ -2,8 +2,7 @@ import copy
|
|
2 |
|
3 |
from transformers import PreTrainedModel, PretrainedConfig, AutoModel, AutoTokenizer
|
4 |
import torch.nn as nn
|
5 |
-
|
6 |
-
from typing import List
|
7 |
|
8 |
|
9 |
class AMC_OPT_conf(PretrainedConfig):
|
@@ -18,7 +17,6 @@ class AMC_OPT_conf(PretrainedConfig):
|
|
18 |
self.drop_out = drop_out
|
19 |
self.emb_size = emb_size
|
20 |
self.pretrained_model = pretrained_model
|
21 |
-
self.fine_tuned_model = "data/models/amc_opt_msmd_nocoadapt.pt"
|
22 |
super().__init__(**kwargs)
|
23 |
|
24 |
|
@@ -53,10 +51,6 @@ class AMC_OPT(PreTrainedModel):
|
|
53 |
def __init__(self, config):
|
54 |
super().__init__(config)
|
55 |
self.model = AMC_OPT_sub(config)
|
56 |
-
self.model.load_state_dict(torch.load(config.fine_tuned_model))
|
57 |
|
58 |
def forward(self, labels, input_ids, attention_mask, **args):
|
59 |
return self.model(labels, input_ids, attention_mask, **args)
|
60 |
-
|
61 |
-
tokenizer = AutoTokenizer.from_pretrained("m-polignano-uniba/bert_uncased_L-12_H-768_A-12_italian_alb3rt0")
|
62 |
-
tokenizer.model_max_length = 128
|
|
|
2 |
|
3 |
from transformers import PreTrainedModel, PretrainedConfig, AutoModel, AutoTokenizer
|
4 |
import torch.nn as nn
|
5 |
+
|
|
|
6 |
|
7 |
|
8 |
class AMC_OPT_conf(PretrainedConfig):
|
|
|
17 |
self.drop_out = drop_out
|
18 |
self.emb_size = emb_size
|
19 |
self.pretrained_model = pretrained_model
|
|
|
20 |
super().__init__(**kwargs)
|
21 |
|
22 |
|
|
|
51 |
def __init__(self, config):
|
52 |
super().__init__(config)
|
53 |
self.model = AMC_OPT_sub(config)
|
|
|
54 |
|
55 |
def forward(self, labels, input_ids, attention_mask, **args):
|
56 |
return self.model(labels, input_ids, attention_mask, **args)
|
|
|
|
|
|
config.json
CHANGED
@@ -2,10 +2,13 @@
|
|
2 |
"architectures": [
|
3 |
"AMC_OPT"
|
4 |
],
|
|
|
|
|
|
|
|
|
5 |
"drop_out": 0.1,
|
6 |
"emb_size": 768,
|
7 |
-
"
|
8 |
-
"model_type": "bert-sa",
|
9 |
"out_labels": 3,
|
10 |
"pretrained_model": "m-polignano-uniba/bert_uncased_L-12_H-768_A-12_italian_alb3rt0",
|
11 |
"torch_dtype": "float32",
|
|
|
2 |
"architectures": [
|
3 |
"AMC_OPT"
|
4 |
],
|
5 |
+
"auto_map": {
|
6 |
+
"AutoConfig": "amc.AMC_OPT_conf",
|
7 |
+
"AutoModelForSequenceClassification": "amc.AMC_OPT"
|
8 |
+
},
|
9 |
"drop_out": 0.1,
|
10 |
"emb_size": 768,
|
11 |
+
"model_type": "bert",
|
|
|
12 |
"out_labels": 3,
|
13 |
"pretrained_model": "m-polignano-uniba/bert_uncased_L-12_H-768_A-12_italian_alb3rt0",
|
14 |
"torch_dtype": "float32",
|
pytorch_model.bin
CHANGED
@@ -1,3 +1,3 @@
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
-
oid sha256:
|
3 |
-
size
|
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:faacdd6b1fcee65d1a748e1e98e0f1c9ba3feb119224dcd9e07741e2f6d67155
|
3 |
+
size 737460205
|