Boriscii commited on
Commit
d364e90
·
verified ·
1 Parent(s): 8ead53e

Upload modified model with logging

Browse files
config.json ADDED
@@ -0,0 +1,55 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "_name_or_path": "facebook/bart-large-mnli",
3
+ "_num_labels": 3,
4
+ "activation_dropout": 0.0,
5
+ "activation_function": "gelu",
6
+ "add_final_layer_norm": false,
7
+ "architectures": [
8
+ "ModifiedBartForSequenceClassificationWithHook"
9
+ ],
10
+ "attention_dropout": 0.0,
11
+ "auto_map": {
12
+ "AutoModel": "model/modeling_modified.py",
13
+ "BartForSequenceClassification": "model/modeling_modified.py"
14
+ },
15
+ "bos_token_id": 0,
16
+ "classif_dropout": 0.0,
17
+ "classifier_dropout": 0.0,
18
+ "d_model": 1024,
19
+ "decoder_attention_heads": 16,
20
+ "decoder_ffn_dim": 4096,
21
+ "decoder_layerdrop": 0.0,
22
+ "decoder_layers": 12,
23
+ "decoder_start_token_id": 2,
24
+ "dropout": 0.1,
25
+ "encoder_attention_heads": 16,
26
+ "encoder_ffn_dim": 4096,
27
+ "encoder_layerdrop": 0.0,
28
+ "encoder_layers": 12,
29
+ "eos_token_id": 2,
30
+ "forced_eos_token_id": 2,
31
+ "gradient_checkpointing": false,
32
+ "id2label": {
33
+ "0": "contradiction",
34
+ "1": "neutral",
35
+ "2": "entailment"
36
+ },
37
+ "init_std": 0.02,
38
+ "is_encoder_decoder": true,
39
+ "label2id": {
40
+ "contradiction": 0,
41
+ "entailment": 2,
42
+ "neutral": 1
43
+ },
44
+ "max_position_embeddings": 1024,
45
+ "model_type": "bart",
46
+ "normalize_before": false,
47
+ "num_hidden_layers": 12,
48
+ "output_past": false,
49
+ "pad_token_id": 1,
50
+ "scale_embedding": false,
51
+ "torch_dtype": "float32",
52
+ "transformers_version": "4.44.2",
53
+ "use_cache": true,
54
+ "vocab_size": 50265
55
+ }
merges.txt ADDED
The diff for this file is too large to render. See raw diff
 
model.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:e0ed99e5d7b71e6d2a8c12c24381892528268147b805754768ad3ff5c69b4dcf
3
+ size 1629436964
model/__init__.py ADDED
@@ -0,0 +1,2 @@
 
 
 
1
+ from .modeling_modified import ModifiedBartForSequenceClassificationWithHook
2
+ from .modeling_modified import ModifiedAutoModelWithHook
model/__pycache__/modeling_modified.cpython-310.pyc ADDED
Binary file (1.42 kB). View file
 
model/modeling_modified.py ADDED
@@ -0,0 +1,31 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import logging
2
+
3
+ import logging
4
+ from transformers import BartForSequenceClassification
5
+
6
+ logger = logging.getLogger("ModelLogger")
7
+
8
+ class ModifiedBartForSequenceClassificationWithHook(BartForSequenceClassification):
9
+ def __init__(self, *args, **kwargs):
10
+ super().__init__(*args, **kwargs)
11
+ self.register_forward_hook(self.forward_hook)
12
+
13
+ @staticmethod
14
+ def forward_hook(module, inputs, outputs):
15
+ logger.info(f"Called forward method of {module.__class__.__name__}")
16
+
17
+
18
+ import logging
19
+ from transformers import AutoModel
20
+
21
+ logger = logging.getLogger("ModelLogger")
22
+
23
+ class ModifiedAutoModelWithHook(AutoModel):
24
+ def __init__(self, *args, **kwargs):
25
+ super().__init__(*args, **kwargs)
26
+ self.register_forward_hook(self.forward_hook)
27
+
28
+ @staticmethod
29
+ def forward_hook(module, inputs, outputs):
30
+ logger.info(f"Called forward method of {module.__class__.__name__}")
31
+
special_tokens_map.json ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "bos_token": "<s>",
3
+ "cls_token": "<s>",
4
+ "eos_token": "</s>",
5
+ "mask_token": {
6
+ "content": "<mask>",
7
+ "lstrip": true,
8
+ "normalized": true,
9
+ "rstrip": false,
10
+ "single_word": false
11
+ },
12
+ "pad_token": "<pad>",
13
+ "sep_token": "</s>",
14
+ "unk_token": "<unk>"
15
+ }
tokenizer.json ADDED
The diff for this file is too large to render. See raw diff
 
tokenizer_config.json ADDED
@@ -0,0 +1,57 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "add_prefix_space": false,
3
+ "added_tokens_decoder": {
4
+ "0": {
5
+ "content": "<s>",
6
+ "lstrip": false,
7
+ "normalized": true,
8
+ "rstrip": false,
9
+ "single_word": false,
10
+ "special": true
11
+ },
12
+ "1": {
13
+ "content": "<pad>",
14
+ "lstrip": false,
15
+ "normalized": true,
16
+ "rstrip": false,
17
+ "single_word": false,
18
+ "special": true
19
+ },
20
+ "2": {
21
+ "content": "</s>",
22
+ "lstrip": false,
23
+ "normalized": true,
24
+ "rstrip": false,
25
+ "single_word": false,
26
+ "special": true
27
+ },
28
+ "3": {
29
+ "content": "<unk>",
30
+ "lstrip": false,
31
+ "normalized": true,
32
+ "rstrip": false,
33
+ "single_word": false,
34
+ "special": true
35
+ },
36
+ "50264": {
37
+ "content": "<mask>",
38
+ "lstrip": true,
39
+ "normalized": true,
40
+ "rstrip": false,
41
+ "single_word": false,
42
+ "special": true
43
+ }
44
+ },
45
+ "bos_token": "<s>",
46
+ "clean_up_tokenization_spaces": true,
47
+ "cls_token": "<s>",
48
+ "eos_token": "</s>",
49
+ "errors": "replace",
50
+ "mask_token": "<mask>",
51
+ "model_max_length": 1024,
52
+ "pad_token": "<pad>",
53
+ "sep_token": "</s>",
54
+ "tokenizer_class": "BartTokenizer",
55
+ "trim_offsets": true,
56
+ "unk_token": "<unk>"
57
+ }
vocab.json ADDED
The diff for this file is too large to render. See raw diff