KoichiYasuoka commited on
Commit
7a3c511
1 Parent(s): 7a26357

initial release

Browse files
README.md ADDED
@@ -0,0 +1,29 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ language:
3
+ - "ja"
4
+ tags:
5
+ - "japanese"
6
+ - "token-classification"
7
+ - "pos"
8
+ datasets:
9
+ - "universal_dependencies"
10
+ license: "apache-2.0"
11
+ pipeline_tag: "token-classification"
12
+ widget:
13
+ - text: "国境の長いトンネルを抜けると雪国であった。"
14
+ ---
15
+
16
+ # RakutenAI-7B-upos
17
+
18
+ ## Model Description
19
+
20
+ This is a Mistral model for POS-tagging, derived from [RakutenAI-7B](https://huggingface.co/Rakuten/RakutenAI-7B). Every short-unit-word is tagged by [UPOS](https://universaldependencies.org/u/pos/) (Universal Part-Of-Speech) and [FEATS](https://universaldependencies.org/u/feat/).
21
+
22
+ ## How to Use
23
+
24
+ ```py
25
+ from transformers import pipeline
26
+ nlp=pipeline("upos","KoichiYasuoka/RakutenAI-7B-upos",trust_remote_code=True,aggregation_strategy="simple")
27
+ print(nlp("国境の長いトンネルを抜けると雪国であった。"))
28
+ ```
29
+
config.json ADDED
@@ -0,0 +1,172 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "architectures": [
3
+ "MistralForTokenClassification"
4
+ ],
5
+ "attention_bias": false,
6
+ "attention_dropout": 0.0,
7
+ "auto_map": {
8
+ "AutoModelForTokenClassification": "upos.MistralForTokenClassification"
9
+ },
10
+ "bos_token_id": 1,
11
+ "custom_pipelines": {
12
+ "upos": {
13
+ "impl": "upos.BellmanFordTokenClassificationPipeline",
14
+ "pt": "AutoModelForTokenClassification"
15
+ },
16
+ "token-classification": {
17
+ "impl": "upos.RawTokenClassificationPipeline",
18
+ "pt": "AutoModelForTokenClassification"
19
+ },
20
+ "ner": {
21
+ "impl": "upos.RawTokenClassificationPipeline",
22
+ "pt": "AutoModelForTokenClassification"
23
+ }
24
+ },
25
+ "eos_token_id": 2,
26
+ "hidden_act": "silu",
27
+ "hidden_size": 4096,
28
+ "id2label": {
29
+ "0": "ADJ",
30
+ "1": "B-ADJ",
31
+ "2": "I-ADJ",
32
+ "3": "ADJ|Polarity=Neg",
33
+ "4": "B-ADJ|Polarity=Neg",
34
+ "5": "I-ADJ|Polarity=Neg",
35
+ "6": "ADP",
36
+ "7": "B-ADP",
37
+ "8": "I-ADP",
38
+ "9": "ADV",
39
+ "10": "B-ADV",
40
+ "11": "I-ADV",
41
+ "12": "AUX",
42
+ "13": "B-AUX",
43
+ "14": "I-AUX",
44
+ "15": "AUX|Polarity=Neg",
45
+ "16": "B-AUX|Polarity=Neg",
46
+ "17": "I-AUX|Polarity=Neg",
47
+ "18": "CCONJ",
48
+ "19": "B-CCONJ",
49
+ "20": "I-CCONJ",
50
+ "21": "DET",
51
+ "22": "B-DET",
52
+ "23": "I-DET",
53
+ "24": "INTJ",
54
+ "25": "B-INTJ",
55
+ "26": "I-INTJ",
56
+ "27": "NOUN",
57
+ "28": "B-NOUN",
58
+ "29": "I-NOUN",
59
+ "30": "NOUN|Polarity=Neg",
60
+ "31": "B-NOUN|Polarity=Neg",
61
+ "32": "I-NOUN|Polarity=Neg",
62
+ "33": "NUM",
63
+ "34": "B-NUM",
64
+ "35": "I-NUM",
65
+ "36": "PART",
66
+ "37": "B-PART",
67
+ "38": "I-PART",
68
+ "39": "PRON",
69
+ "40": "B-PRON",
70
+ "41": "I-PRON",
71
+ "42": "PROPN",
72
+ "43": "B-PROPN",
73
+ "44": "I-PROPN",
74
+ "45": "PUNCT",
75
+ "46": "B-PUNCT",
76
+ "47": "I-PUNCT",
77
+ "48": "SCONJ",
78
+ "49": "B-SCONJ",
79
+ "50": "I-SCONJ",
80
+ "51": "SYM",
81
+ "52": "B-SYM",
82
+ "53": "I-SYM",
83
+ "54": "VERB",
84
+ "55": "B-VERB",
85
+ "56": "I-VERB",
86
+ "57": "X",
87
+ "58": "B-X",
88
+ "59": "I-X"
89
+ },
90
+ "initializer_range": 0.02,
91
+ "intermediate_size": 14336,
92
+ "label2id": {
93
+ "ADJ": 0,
94
+ "ADJ|Polarity=Neg": 3,
95
+ "ADP": 6,
96
+ "ADV": 9,
97
+ "AUX": 12,
98
+ "AUX|Polarity=Neg": 15,
99
+ "B-ADJ": 1,
100
+ "B-ADJ|Polarity=Neg": 4,
101
+ "B-ADP": 7,
102
+ "B-ADV": 10,
103
+ "B-AUX": 13,
104
+ "B-AUX|Polarity=Neg": 16,
105
+ "B-CCONJ": 19,
106
+ "B-DET": 22,
107
+ "B-INTJ": 25,
108
+ "B-NOUN": 28,
109
+ "B-NOUN|Polarity=Neg": 31,
110
+ "B-NUM": 34,
111
+ "B-PART": 37,
112
+ "B-PRON": 40,
113
+ "B-PROPN": 43,
114
+ "B-PUNCT": 46,
115
+ "B-SCONJ": 49,
116
+ "B-SYM": 52,
117
+ "B-VERB": 55,
118
+ "B-X": 58,
119
+ "CCONJ": 18,
120
+ "DET": 21,
121
+ "I-ADJ": 2,
122
+ "I-ADJ|Polarity=Neg": 5,
123
+ "I-ADP": 8,
124
+ "I-ADV": 11,
125
+ "I-AUX": 14,
126
+ "I-AUX|Polarity=Neg": 17,
127
+ "I-CCONJ": 20,
128
+ "I-DET": 23,
129
+ "I-INTJ": 26,
130
+ "I-NOUN": 29,
131
+ "I-NOUN|Polarity=Neg": 32,
132
+ "I-NUM": 35,
133
+ "I-PART": 38,
134
+ "I-PRON": 41,
135
+ "I-PROPN": 44,
136
+ "I-PUNCT": 47,
137
+ "I-SCONJ": 50,
138
+ "I-SYM": 53,
139
+ "I-VERB": 56,
140
+ "I-X": 59,
141
+ "INTJ": 24,
142
+ "NOUN": 27,
143
+ "NOUN|Polarity=Neg": 30,
144
+ "NUM": 33,
145
+ "PART": 36,
146
+ "PRON": 39,
147
+ "PROPN": 42,
148
+ "PUNCT": 45,
149
+ "SCONJ": 48,
150
+ "SYM": 51,
151
+ "VERB": 54,
152
+ "X": 57
153
+ },
154
+ "max_position_embeddings": 32768,
155
+ "mlp_bias": false,
156
+ "model_type": "llama",
157
+ "num_attention_heads": 32,
158
+ "num_hidden_layers": 32,
159
+ "num_key_value_heads": 8,
160
+ "pretraining_tp": 1,
161
+ "rms_norm_eps": 1e-05,
162
+ "rope_scaling": null,
163
+ "rope_theta": 10000.0,
164
+ "sliding_window": 4096,
165
+ "tie_word_embeddings": false,
166
+ "tokenizer_class": "LlamaTokenizerFast",
167
+ "torch_dtype": "float32",
168
+ "transformers_version": "4.41.2",
169
+ "use_cache": true,
170
+ "use_transformers_inputs": true,
171
+ "vocab_size": 48000
172
+ }
maker.sh ADDED
@@ -0,0 +1,159 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #! /bin/sh
2
+ test -f ja_gsd_modern.conllu || curl -LO https://github.com/KoichiYasuoka/SuPar-UniDic/raw/main/suparunidic/suparmodels/ja_gsd_modern.conllu
3
+
4
+ if [ ! -d exRakutenAI-7B ]
5
+ then TMPA=./maker$$a.py
6
+ cat << 'EOF' > $TMPA
7
+ #! /usr/bin/python3
8
+ src="Rakuten/RakutenAI-7B"
9
+ tgt="exRakutenAI-7B"
10
+ import json,torch,unicodedata
11
+ from transformers import LlamaTokenizerFast,LlamaForCausalLM
12
+ tkz=LlamaTokenizerFast.from_pretrained(src,cls_token="<s>",sep_token="<s>",mask_token="<unk>",pad_token="</s>")
13
+ d=json.loads(tkz.backend_tokenizer.to_str())
14
+ tkz.backend_tokenizer.from_str(json.dumps(d)).save("tokenizer.json")
15
+ mdl=LlamaForCausalLM.from_pretrained(src)
16
+ tkz=LlamaTokenizerFast(tokenizer_file="tokenizer.json",model_max_length=mdl.config.max_position_embeddings,cls_token="<s>",sep_token="<s>",mask_token="<unk>",pad_token="</s>")
17
+ e=mdl.resize_token_embeddings(len(tkz))
18
+ f=mdl.get_output_embeddings()
19
+ mdl.set_input_embeddings(e)
20
+ mdl.set_output_embeddings(f)
21
+ mdl.save_pretrained(tgt)
22
+ tkz.save_pretrained(tgt)
23
+ EOF
24
+ chmod 755 $TMPA
25
+ $TMPA
26
+ fi
27
+
28
+ TMPB=./maker$$b.py
29
+ cat << 'EOF' > $TMPB
30
+ #! /usr/bin/env deepspeed
31
+ src="exRakutenAI-7B"
32
+ tgt="KoichiYasuoka/RakutenAI-7B-upos"
33
+ from transformers import LlamaTokenizerFast,MistralModel,MistralPreTrainedModel,AutoConfig,DataCollatorForTokenClassification,TrainingArguments,Trainer
34
+ from transformers.modeling_outputs import TokenClassifierOutput
35
+ from tokenizers.normalizers import Replace
36
+
37
+ class MistralForTokenClassification(MistralPreTrainedModel):
38
+ def __init__(self,config):
39
+ from torch import nn
40
+ super().__init__(config)
41
+ self.num_labels=config.num_labels
42
+ self.model=MistralModel(config)
43
+ if hasattr(config,"classifier_dropout") and config.classifier_dropout is not None:
44
+ classifier_dropout=config.classifier_dropout
45
+ elif hasattr(config,"hidden_dropout") and config.hidden_dropout is not None:
46
+ classifier_dropout=config.hidden_dropout
47
+ else:
48
+ classifier_dropout=0.1
49
+ self.dropout=nn.Dropout(classifier_dropout)
50
+ self.classifier=nn.Linear(config.hidden_size,config.num_labels)
51
+ self.post_init()
52
+ def get_input_embeddings(self):
53
+ return self.model.embed_tokens
54
+ def set_input_embeddings(self,value):
55
+ self.model.embed_tokens=value
56
+ def forward(self,input_ids=None,past_key_values=None,attention_mask=None,position_ids=None,inputs_embeds=None,labels=None,use_cache=None,output_attentions=None,output_hidden_states=None,return_dict=None):
57
+ return_dict=return_dict if return_dict is not None else self.config.use_return_dict
58
+ transformer_outputs=self.model(input_ids,past_key_values=past_key_values,attention_mask=attention_mask,position_ids=position_ids,inputs_embeds=inputs_embeds,use_cache=use_cache,output_attentions=output_attentions,output_hidden_states=output_hidden_states,return_dict=return_dict)
59
+ hidden_states=transformer_outputs[0]
60
+ hidden_states=self.dropout(hidden_states)
61
+ logits=self.classifier(hidden_states)
62
+ loss=None
63
+ if labels is not None:
64
+ from torch import nn
65
+ loss_fct=nn.CrossEntropyLoss()
66
+ loss=loss_fct(logits.view(-1,self.num_labels),labels.view(-1))
67
+ if not return_dict:
68
+ output=(logits,)+transformer_outputs[2:]
69
+ return ((loss,)+output) if loss is not None else output
70
+ return TokenClassifierOutput(loss=loss,logits=logits,hidden_states=transformer_outputs.hidden_states,attentions=transformer_outputs.attentions)
71
+
72
+ class UPOSFileDataset(object):
73
+ def __init__(self,conllu,tokenizer):
74
+ self.conllu=open(conllu,"r",encoding="utf-8")
75
+ self.tokenizer=tokenizer
76
+ self.seeks=[0]
77
+ self.multiword={}
78
+ label=set(["SYM"])
79
+ s=self.conllu.readline()
80
+ while s!="":
81
+ if s=="\n":
82
+ self.seeks.append(self.conllu.tell())
83
+ else:
84
+ w=s.split("\t")
85
+ if len(w)==10:
86
+ if w[0].isdecimal():
87
+ label.add(w[3] if w[5]=="_" else w[3]+"|"+w[5])
88
+ elif w[0].find("-")>0:
89
+ t=w[0].split("-")
90
+ f,j,k=w[1],[],[]
91
+ for i in range(int(t[0]),int(t[1])+1):
92
+ w=self.conllu.readline().split("\t")
93
+ j.append(w[3] if w[5]=="_" else w[3]+"|"+w[5])
94
+ k.append(w[1])
95
+ p="+".join(j)
96
+ label.add(p)
97
+ if p in self.multiword:
98
+ self.multiword[p][f]=list(k)
99
+ else:
100
+ self.multiword[p]={f:list(k)}
101
+ s=self.conllu.readline()
102
+ lid={}
103
+ for i,l in enumerate(sorted(label)):
104
+ lid[l],lid["B-"+l],lid["I-"+l]=i*3,i*3+1,i*3+2
105
+ self.label2id=lid
106
+ def __call__(*args):
107
+ lid={l:i for i,l in enumerate(sorted(set(sum([list(t.label2id) for t in args],[]))))}
108
+ for t in args:
109
+ t.label2id=lid
110
+ return lid
111
+ def __del__(self):
112
+ self.conllu.close()
113
+ __len__=lambda self:len(self.seeks)-1
114
+ def __getitem__(self,i):
115
+ self.conllu.seek(self.seeks[i])
116
+ form,upos=[],[]
117
+ while self.conllu.tell()<self.seeks[i+1]:
118
+ w=self.conllu.readline().split("\t")
119
+ if len(w)==10:
120
+ form.append(w[1])
121
+ if w[0].isdecimal():
122
+ upos.append(w[3] if w[5]=="_" else w[3]+"|"+w[5])
123
+ elif w[0].find("-")>0:
124
+ t=w[0].split("-")
125
+ u=[]
126
+ for j in range(int(t[0]),int(t[1])+1):
127
+ k=self.conllu.readline().split("\t")
128
+ u.append(k[3] if k[5]=="_" else k[3]+"|"+k[5])
129
+ upos.append("+".join(u))
130
+ v=self.tokenizer(form,add_special_tokens=False)
131
+ i,u=[],[]
132
+ for j,(x,y) in enumerate(zip(v["input_ids"],upos)):
133
+ if x!=[]:
134
+ i+=x
135
+ u+=[y] if len(x)==1 else ["B-"+y]+["I-"+y]*(len(x)-1)
136
+ if len(i)<self.tokenizer.model_max_length-3:
137
+ ids=[self.tokenizer.cls_token_id]+i+[self.tokenizer.sep_token_id]
138
+ upos=["SYM"]+u+["SYM"]
139
+ else:
140
+ ids=i[0:self.tokenizer.model_max_length-2]
141
+ upos=u[0:self.tokenizer.model_max_length-2]
142
+ return {"input_ids":ids,"labels":[self.label2id[t] for t in upos]}
143
+
144
+ tkz=LlamaTokenizerFast.from_pretrained(src)
145
+ tkz.backend_tokenizer.normalizer=Replace(" ","\u2581")
146
+ tkz.backend_tokenizer.model.byte_fallback=False
147
+ trainDS=UPOSFileDataset("ja_gsd_modern.conllu",tkz)
148
+ lid=trainDS.label2id
149
+ cfg=AutoConfig.from_pretrained(src,num_labels=len(lid),label2id=lid,id2label={i:l for l,i in lid.items()},ignore_mismatched_sizes=True)
150
+ dsp={"fp16":{"enabled":"auto"},"optimizer":{"type":"AdamW"},"scheduler":{"type":"WarmupLR","params":{}},"train_batch_size":"auto","train_micro_batch_size_per_gpu":"auto","zero_optimization":{"stage":3,"offload_optimizer":{"device":"cpu","pin_memory":True},"offload_param":{"device":"cpu","pin_memory":True},"overlap_comm":True,"contiguous_gradients":True,"reduce_bucket_size":"auto","stage3_prefetch_bucket_size":"auto","stage3_param_persistence_threshold":"auto","stage3_gather_16bit_weights_on_model_save":True}}
151
+ arg=TrainingArguments(num_train_epochs=3,per_device_train_batch_size=8,deepspeed=dsp,output_dir=tgt,overwrite_output_dir=True,save_total_limit=2,learning_rate=5e-05,warmup_ratio=0.1,save_safetensors=False)
152
+ trn=Trainer(args=arg,data_collator=DataCollatorForTokenClassification(tkz),model=MistralForTokenClassification.from_pretrained(src,config=cfg,ignore_mismatched_sizes=True),train_dataset=trainDS)
153
+ trn.train()
154
+ trn.save_model(tgt)
155
+ tkz.save_pretrained(tgt)
156
+ EOF
157
+ chmod 755 $TMPB
158
+ $TMPB
159
+ exit
pytorch_model-00001-of-00006.bin ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:4a128f8336000537c6c39ca74e420cfb9956bc7c841ef8bb50f96a40987b6241
3
+ size 4913773120
pytorch_model-00002-of-00006.bin ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:d1d7b91b1e45f9e0855c1c29f6dc9983ddcef815d173c824092af0904878e232
3
+ size 4999825256
pytorch_model-00003-of-00006.bin ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:92fb33dbe24eaad850999581fb2ae632084ae5ce87e80beeed1cba286d030a14
3
+ size 4999825316
pytorch_model-00004-of-00006.bin ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:28c869bd6aa3b5e326f4cb150c244932221a2bc2705f1a1194212b81bc1eda8b
3
+ size 4832018324
pytorch_model-00005-of-00006.bin ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:3b00232b29f97013a73c0b4c5b4e40bfc2820373c6e7840fcbb50f937719325e
3
+ size 4999825320
pytorch_model-00006-of-00006.bin ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:ae36d8b8087d2f67794b1729487f467e683552efd5fe18efbede57d451ff025b
3
+ size 3960601264
pytorch_model.bin.index.json ADDED
@@ -0,0 +1,299 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "metadata": {
3
+ "total_size": 28705767664
4
+ },
5
+ "weight_map": {
6
+ "classifier.bias": "pytorch_model-00006-of-00006.bin",
7
+ "classifier.weight": "pytorch_model-00006-of-00006.bin",
8
+ "model.embed_tokens.weight": "pytorch_model-00001-of-00006.bin",
9
+ "model.layers.0.input_layernorm.weight": "pytorch_model-00001-of-00006.bin",
10
+ "model.layers.0.mlp.down_proj.weight": "pytorch_model-00001-of-00006.bin",
11
+ "model.layers.0.mlp.gate_proj.weight": "pytorch_model-00001-of-00006.bin",
12
+ "model.layers.0.mlp.up_proj.weight": "pytorch_model-00001-of-00006.bin",
13
+ "model.layers.0.post_attention_layernorm.weight": "pytorch_model-00001-of-00006.bin",
14
+ "model.layers.0.self_attn.k_proj.weight": "pytorch_model-00001-of-00006.bin",
15
+ "model.layers.0.self_attn.o_proj.weight": "pytorch_model-00001-of-00006.bin",
16
+ "model.layers.0.self_attn.q_proj.weight": "pytorch_model-00001-of-00006.bin",
17
+ "model.layers.0.self_attn.v_proj.weight": "pytorch_model-00001-of-00006.bin",
18
+ "model.layers.1.input_layernorm.weight": "pytorch_model-00001-of-00006.bin",
19
+ "model.layers.1.mlp.down_proj.weight": "pytorch_model-00001-of-00006.bin",
20
+ "model.layers.1.mlp.gate_proj.weight": "pytorch_model-00001-of-00006.bin",
21
+ "model.layers.1.mlp.up_proj.weight": "pytorch_model-00001-of-00006.bin",
22
+ "model.layers.1.post_attention_layernorm.weight": "pytorch_model-00001-of-00006.bin",
23
+ "model.layers.1.self_attn.k_proj.weight": "pytorch_model-00001-of-00006.bin",
24
+ "model.layers.1.self_attn.o_proj.weight": "pytorch_model-00001-of-00006.bin",
25
+ "model.layers.1.self_attn.q_proj.weight": "pytorch_model-00001-of-00006.bin",
26
+ "model.layers.1.self_attn.v_proj.weight": "pytorch_model-00001-of-00006.bin",
27
+ "model.layers.10.input_layernorm.weight": "pytorch_model-00003-of-00006.bin",
28
+ "model.layers.10.mlp.down_proj.weight": "pytorch_model-00003-of-00006.bin",
29
+ "model.layers.10.mlp.gate_proj.weight": "pytorch_model-00002-of-00006.bin",
30
+ "model.layers.10.mlp.up_proj.weight": "pytorch_model-00003-of-00006.bin",
31
+ "model.layers.10.post_attention_layernorm.weight": "pytorch_model-00003-of-00006.bin",
32
+ "model.layers.10.self_attn.k_proj.weight": "pytorch_model-00002-of-00006.bin",
33
+ "model.layers.10.self_attn.o_proj.weight": "pytorch_model-00002-of-00006.bin",
34
+ "model.layers.10.self_attn.q_proj.weight": "pytorch_model-00002-of-00006.bin",
35
+ "model.layers.10.self_attn.v_proj.weight": "pytorch_model-00002-of-00006.bin",
36
+ "model.layers.11.input_layernorm.weight": "pytorch_model-00003-of-00006.bin",
37
+ "model.layers.11.mlp.down_proj.weight": "pytorch_model-00003-of-00006.bin",
38
+ "model.layers.11.mlp.gate_proj.weight": "pytorch_model-00003-of-00006.bin",
39
+ "model.layers.11.mlp.up_proj.weight": "pytorch_model-00003-of-00006.bin",
40
+ "model.layers.11.post_attention_layernorm.weight": "pytorch_model-00003-of-00006.bin",
41
+ "model.layers.11.self_attn.k_proj.weight": "pytorch_model-00003-of-00006.bin",
42
+ "model.layers.11.self_attn.o_proj.weight": "pytorch_model-00003-of-00006.bin",
43
+ "model.layers.11.self_attn.q_proj.weight": "pytorch_model-00003-of-00006.bin",
44
+ "model.layers.11.self_attn.v_proj.weight": "pytorch_model-00003-of-00006.bin",
45
+ "model.layers.12.input_layernorm.weight": "pytorch_model-00003-of-00006.bin",
46
+ "model.layers.12.mlp.down_proj.weight": "pytorch_model-00003-of-00006.bin",
47
+ "model.layers.12.mlp.gate_proj.weight": "pytorch_model-00003-of-00006.bin",
48
+ "model.layers.12.mlp.up_proj.weight": "pytorch_model-00003-of-00006.bin",
49
+ "model.layers.12.post_attention_layernorm.weight": "pytorch_model-00003-of-00006.bin",
50
+ "model.layers.12.self_attn.k_proj.weight": "pytorch_model-00003-of-00006.bin",
51
+ "model.layers.12.self_attn.o_proj.weight": "pytorch_model-00003-of-00006.bin",
52
+ "model.layers.12.self_attn.q_proj.weight": "pytorch_model-00003-of-00006.bin",
53
+ "model.layers.12.self_attn.v_proj.weight": "pytorch_model-00003-of-00006.bin",
54
+ "model.layers.13.input_layernorm.weight": "pytorch_model-00003-of-00006.bin",
55
+ "model.layers.13.mlp.down_proj.weight": "pytorch_model-00003-of-00006.bin",
56
+ "model.layers.13.mlp.gate_proj.weight": "pytorch_model-00003-of-00006.bin",
57
+ "model.layers.13.mlp.up_proj.weight": "pytorch_model-00003-of-00006.bin",
58
+ "model.layers.13.post_attention_layernorm.weight": "pytorch_model-00003-of-00006.bin",
59
+ "model.layers.13.self_attn.k_proj.weight": "pytorch_model-00003-of-00006.bin",
60
+ "model.layers.13.self_attn.o_proj.weight": "pytorch_model-00003-of-00006.bin",
61
+ "model.layers.13.self_attn.q_proj.weight": "pytorch_model-00003-of-00006.bin",
62
+ "model.layers.13.self_attn.v_proj.weight": "pytorch_model-00003-of-00006.bin",
63
+ "model.layers.14.input_layernorm.weight": "pytorch_model-00003-of-00006.bin",
64
+ "model.layers.14.mlp.down_proj.weight": "pytorch_model-00003-of-00006.bin",
65
+ "model.layers.14.mlp.gate_proj.weight": "pytorch_model-00003-of-00006.bin",
66
+ "model.layers.14.mlp.up_proj.weight": "pytorch_model-00003-of-00006.bin",
67
+ "model.layers.14.post_attention_layernorm.weight": "pytorch_model-00003-of-00006.bin",
68
+ "model.layers.14.self_attn.k_proj.weight": "pytorch_model-00003-of-00006.bin",
69
+ "model.layers.14.self_attn.o_proj.weight": "pytorch_model-00003-of-00006.bin",
70
+ "model.layers.14.self_attn.q_proj.weight": "pytorch_model-00003-of-00006.bin",
71
+ "model.layers.14.self_attn.v_proj.weight": "pytorch_model-00003-of-00006.bin",
72
+ "model.layers.15.input_layernorm.weight": "pytorch_model-00003-of-00006.bin",
73
+ "model.layers.15.mlp.down_proj.weight": "pytorch_model-00003-of-00006.bin",
74
+ "model.layers.15.mlp.gate_proj.weight": "pytorch_model-00003-of-00006.bin",
75
+ "model.layers.15.mlp.up_proj.weight": "pytorch_model-00003-of-00006.bin",
76
+ "model.layers.15.post_attention_layernorm.weight": "pytorch_model-00003-of-00006.bin",
77
+ "model.layers.15.self_attn.k_proj.weight": "pytorch_model-00003-of-00006.bin",
78
+ "model.layers.15.self_attn.o_proj.weight": "pytorch_model-00003-of-00006.bin",
79
+ "model.layers.15.self_attn.q_proj.weight": "pytorch_model-00003-of-00006.bin",
80
+ "model.layers.15.self_attn.v_proj.weight": "pytorch_model-00003-of-00006.bin",
81
+ "model.layers.16.input_layernorm.weight": "pytorch_model-00004-of-00006.bin",
82
+ "model.layers.16.mlp.down_proj.weight": "pytorch_model-00004-of-00006.bin",
83
+ "model.layers.16.mlp.gate_proj.weight": "pytorch_model-00004-of-00006.bin",
84
+ "model.layers.16.mlp.up_proj.weight": "pytorch_model-00004-of-00006.bin",
85
+ "model.layers.16.post_attention_layernorm.weight": "pytorch_model-00004-of-00006.bin",
86
+ "model.layers.16.self_attn.k_proj.weight": "pytorch_model-00003-of-00006.bin",
87
+ "model.layers.16.self_attn.o_proj.weight": "pytorch_model-00003-of-00006.bin",
88
+ "model.layers.16.self_attn.q_proj.weight": "pytorch_model-00003-of-00006.bin",
89
+ "model.layers.16.self_attn.v_proj.weight": "pytorch_model-00003-of-00006.bin",
90
+ "model.layers.17.input_layernorm.weight": "pytorch_model-00004-of-00006.bin",
91
+ "model.layers.17.mlp.down_proj.weight": "pytorch_model-00004-of-00006.bin",
92
+ "model.layers.17.mlp.gate_proj.weight": "pytorch_model-00004-of-00006.bin",
93
+ "model.layers.17.mlp.up_proj.weight": "pytorch_model-00004-of-00006.bin",
94
+ "model.layers.17.post_attention_layernorm.weight": "pytorch_model-00004-of-00006.bin",
95
+ "model.layers.17.self_attn.k_proj.weight": "pytorch_model-00004-of-00006.bin",
96
+ "model.layers.17.self_attn.o_proj.weight": "pytorch_model-00004-of-00006.bin",
97
+ "model.layers.17.self_attn.q_proj.weight": "pytorch_model-00004-of-00006.bin",
98
+ "model.layers.17.self_attn.v_proj.weight": "pytorch_model-00004-of-00006.bin",
99
+ "model.layers.18.input_layernorm.weight": "pytorch_model-00004-of-00006.bin",
100
+ "model.layers.18.mlp.down_proj.weight": "pytorch_model-00004-of-00006.bin",
101
+ "model.layers.18.mlp.gate_proj.weight": "pytorch_model-00004-of-00006.bin",
102
+ "model.layers.18.mlp.up_proj.weight": "pytorch_model-00004-of-00006.bin",
103
+ "model.layers.18.post_attention_layernorm.weight": "pytorch_model-00004-of-00006.bin",
104
+ "model.layers.18.self_attn.k_proj.weight": "pytorch_model-00004-of-00006.bin",
105
+ "model.layers.18.self_attn.o_proj.weight": "pytorch_model-00004-of-00006.bin",
106
+ "model.layers.18.self_attn.q_proj.weight": "pytorch_model-00004-of-00006.bin",
107
+ "model.layers.18.self_attn.v_proj.weight": "pytorch_model-00004-of-00006.bin",
108
+ "model.layers.19.input_layernorm.weight": "pytorch_model-00004-of-00006.bin",
109
+ "model.layers.19.mlp.down_proj.weight": "pytorch_model-00004-of-00006.bin",
110
+ "model.layers.19.mlp.gate_proj.weight": "pytorch_model-00004-of-00006.bin",
111
+ "model.layers.19.mlp.up_proj.weight": "pytorch_model-00004-of-00006.bin",
112
+ "model.layers.19.post_attention_layernorm.weight": "pytorch_model-00004-of-00006.bin",
113
+ "model.layers.19.self_attn.k_proj.weight": "pytorch_model-00004-of-00006.bin",
114
+ "model.layers.19.self_attn.o_proj.weight": "pytorch_model-00004-of-00006.bin",
115
+ "model.layers.19.self_attn.q_proj.weight": "pytorch_model-00004-of-00006.bin",
116
+ "model.layers.19.self_attn.v_proj.weight": "pytorch_model-00004-of-00006.bin",
117
+ "model.layers.2.input_layernorm.weight": "pytorch_model-00001-of-00006.bin",
118
+ "model.layers.2.mlp.down_proj.weight": "pytorch_model-00001-of-00006.bin",
119
+ "model.layers.2.mlp.gate_proj.weight": "pytorch_model-00001-of-00006.bin",
120
+ "model.layers.2.mlp.up_proj.weight": "pytorch_model-00001-of-00006.bin",
121
+ "model.layers.2.post_attention_layernorm.weight": "pytorch_model-00001-of-00006.bin",
122
+ "model.layers.2.self_attn.k_proj.weight": "pytorch_model-00001-of-00006.bin",
123
+ "model.layers.2.self_attn.o_proj.weight": "pytorch_model-00001-of-00006.bin",
124
+ "model.layers.2.self_attn.q_proj.weight": "pytorch_model-00001-of-00006.bin",
125
+ "model.layers.2.self_attn.v_proj.weight": "pytorch_model-00001-of-00006.bin",
126
+ "model.layers.20.input_layernorm.weight": "pytorch_model-00004-of-00006.bin",
127
+ "model.layers.20.mlp.down_proj.weight": "pytorch_model-00004-of-00006.bin",
128
+ "model.layers.20.mlp.gate_proj.weight": "pytorch_model-00004-of-00006.bin",
129
+ "model.layers.20.mlp.up_proj.weight": "pytorch_model-00004-of-00006.bin",
130
+ "model.layers.20.post_attention_layernorm.weight": "pytorch_model-00004-of-00006.bin",
131
+ "model.layers.20.self_attn.k_proj.weight": "pytorch_model-00004-of-00006.bin",
132
+ "model.layers.20.self_attn.o_proj.weight": "pytorch_model-00004-of-00006.bin",
133
+ "model.layers.20.self_attn.q_proj.weight": "pytorch_model-00004-of-00006.bin",
134
+ "model.layers.20.self_attn.v_proj.weight": "pytorch_model-00004-of-00006.bin",
135
+ "model.layers.21.input_layernorm.weight": "pytorch_model-00005-of-00006.bin",
136
+ "model.layers.21.mlp.down_proj.weight": "pytorch_model-00005-of-00006.bin",
137
+ "model.layers.21.mlp.gate_proj.weight": "pytorch_model-00004-of-00006.bin",
138
+ "model.layers.21.mlp.up_proj.weight": "pytorch_model-00004-of-00006.bin",
139
+ "model.layers.21.post_attention_layernorm.weight": "pytorch_model-00005-of-00006.bin",
140
+ "model.layers.21.self_attn.k_proj.weight": "pytorch_model-00004-of-00006.bin",
141
+ "model.layers.21.self_attn.o_proj.weight": "pytorch_model-00004-of-00006.bin",
142
+ "model.layers.21.self_attn.q_proj.weight": "pytorch_model-00004-of-00006.bin",
143
+ "model.layers.21.self_attn.v_proj.weight": "pytorch_model-00004-of-00006.bin",
144
+ "model.layers.22.input_layernorm.weight": "pytorch_model-00005-of-00006.bin",
145
+ "model.layers.22.mlp.down_proj.weight": "pytorch_model-00005-of-00006.bin",
146
+ "model.layers.22.mlp.gate_proj.weight": "pytorch_model-00005-of-00006.bin",
147
+ "model.layers.22.mlp.up_proj.weight": "pytorch_model-00005-of-00006.bin",
148
+ "model.layers.22.post_attention_layernorm.weight": "pytorch_model-00005-of-00006.bin",
149
+ "model.layers.22.self_attn.k_proj.weight": "pytorch_model-00005-of-00006.bin",
150
+ "model.layers.22.self_attn.o_proj.weight": "pytorch_model-00005-of-00006.bin",
151
+ "model.layers.22.self_attn.q_proj.weight": "pytorch_model-00005-of-00006.bin",
152
+ "model.layers.22.self_attn.v_proj.weight": "pytorch_model-00005-of-00006.bin",
153
+ "model.layers.23.input_layernorm.weight": "pytorch_model-00005-of-00006.bin",
154
+ "model.layers.23.mlp.down_proj.weight": "pytorch_model-00005-of-00006.bin",
155
+ "model.layers.23.mlp.gate_proj.weight": "pytorch_model-00005-of-00006.bin",
156
+ "model.layers.23.mlp.up_proj.weight": "pytorch_model-00005-of-00006.bin",
157
+ "model.layers.23.post_attention_layernorm.weight": "pytorch_model-00005-of-00006.bin",
158
+ "model.layers.23.self_attn.k_proj.weight": "pytorch_model-00005-of-00006.bin",
159
+ "model.layers.23.self_attn.o_proj.weight": "pytorch_model-00005-of-00006.bin",
160
+ "model.layers.23.self_attn.q_proj.weight": "pytorch_model-00005-of-00006.bin",
161
+ "model.layers.23.self_attn.v_proj.weight": "pytorch_model-00005-of-00006.bin",
162
+ "model.layers.24.input_layernorm.weight": "pytorch_model-00005-of-00006.bin",
163
+ "model.layers.24.mlp.down_proj.weight": "pytorch_model-00005-of-00006.bin",
164
+ "model.layers.24.mlp.gate_proj.weight": "pytorch_model-00005-of-00006.bin",
165
+ "model.layers.24.mlp.up_proj.weight": "pytorch_model-00005-of-00006.bin",
166
+ "model.layers.24.post_attention_layernorm.weight": "pytorch_model-00005-of-00006.bin",
167
+ "model.layers.24.self_attn.k_proj.weight": "pytorch_model-00005-of-00006.bin",
168
+ "model.layers.24.self_attn.o_proj.weight": "pytorch_model-00005-of-00006.bin",
169
+ "model.layers.24.self_attn.q_proj.weight": "pytorch_model-00005-of-00006.bin",
170
+ "model.layers.24.self_attn.v_proj.weight": "pytorch_model-00005-of-00006.bin",
171
+ "model.layers.25.input_layernorm.weight": "pytorch_model-00005-of-00006.bin",
172
+ "model.layers.25.mlp.down_proj.weight": "pytorch_model-00005-of-00006.bin",
173
+ "model.layers.25.mlp.gate_proj.weight": "pytorch_model-00005-of-00006.bin",
174
+ "model.layers.25.mlp.up_proj.weight": "pytorch_model-00005-of-00006.bin",
175
+ "model.layers.25.post_attention_layernorm.weight": "pytorch_model-00005-of-00006.bin",
176
+ "model.layers.25.self_attn.k_proj.weight": "pytorch_model-00005-of-00006.bin",
177
+ "model.layers.25.self_attn.o_proj.weight": "pytorch_model-00005-of-00006.bin",
178
+ "model.layers.25.self_attn.q_proj.weight": "pytorch_model-00005-of-00006.bin",
179
+ "model.layers.25.self_attn.v_proj.weight": "pytorch_model-00005-of-00006.bin",
180
+ "model.layers.26.input_layernorm.weight": "pytorch_model-00005-of-00006.bin",
181
+ "model.layers.26.mlp.down_proj.weight": "pytorch_model-00005-of-00006.bin",
182
+ "model.layers.26.mlp.gate_proj.weight": "pytorch_model-00005-of-00006.bin",
183
+ "model.layers.26.mlp.up_proj.weight": "pytorch_model-00005-of-00006.bin",
184
+ "model.layers.26.post_attention_layernorm.weight": "pytorch_model-00005-of-00006.bin",
185
+ "model.layers.26.self_attn.k_proj.weight": "pytorch_model-00005-of-00006.bin",
186
+ "model.layers.26.self_attn.o_proj.weight": "pytorch_model-00005-of-00006.bin",
187
+ "model.layers.26.self_attn.q_proj.weight": "pytorch_model-00005-of-00006.bin",
188
+ "model.layers.26.self_attn.v_proj.weight": "pytorch_model-00005-of-00006.bin",
189
+ "model.layers.27.input_layernorm.weight": "pytorch_model-00006-of-00006.bin",
190
+ "model.layers.27.mlp.down_proj.weight": "pytorch_model-00006-of-00006.bin",
191
+ "model.layers.27.mlp.gate_proj.weight": "pytorch_model-00005-of-00006.bin",
192
+ "model.layers.27.mlp.up_proj.weight": "pytorch_model-00006-of-00006.bin",
193
+ "model.layers.27.post_attention_layernorm.weight": "pytorch_model-00006-of-00006.bin",
194
+ "model.layers.27.self_attn.k_proj.weight": "pytorch_model-00005-of-00006.bin",
195
+ "model.layers.27.self_attn.o_proj.weight": "pytorch_model-00005-of-00006.bin",
196
+ "model.layers.27.self_attn.q_proj.weight": "pytorch_model-00005-of-00006.bin",
197
+ "model.layers.27.self_attn.v_proj.weight": "pytorch_model-00005-of-00006.bin",
198
+ "model.layers.28.input_layernorm.weight": "pytorch_model-00006-of-00006.bin",
199
+ "model.layers.28.mlp.down_proj.weight": "pytorch_model-00006-of-00006.bin",
200
+ "model.layers.28.mlp.gate_proj.weight": "pytorch_model-00006-of-00006.bin",
201
+ "model.layers.28.mlp.up_proj.weight": "pytorch_model-00006-of-00006.bin",
202
+ "model.layers.28.post_attention_layernorm.weight": "pytorch_model-00006-of-00006.bin",
203
+ "model.layers.28.self_attn.k_proj.weight": "pytorch_model-00006-of-00006.bin",
204
+ "model.layers.28.self_attn.o_proj.weight": "pytorch_model-00006-of-00006.bin",
205
+ "model.layers.28.self_attn.q_proj.weight": "pytorch_model-00006-of-00006.bin",
206
+ "model.layers.28.self_attn.v_proj.weight": "pytorch_model-00006-of-00006.bin",
207
+ "model.layers.29.input_layernorm.weight": "pytorch_model-00006-of-00006.bin",
208
+ "model.layers.29.mlp.down_proj.weight": "pytorch_model-00006-of-00006.bin",
209
+ "model.layers.29.mlp.gate_proj.weight": "pytorch_model-00006-of-00006.bin",
210
+ "model.layers.29.mlp.up_proj.weight": "pytorch_model-00006-of-00006.bin",
211
+ "model.layers.29.post_attention_layernorm.weight": "pytorch_model-00006-of-00006.bin",
212
+ "model.layers.29.self_attn.k_proj.weight": "pytorch_model-00006-of-00006.bin",
213
+ "model.layers.29.self_attn.o_proj.weight": "pytorch_model-00006-of-00006.bin",
214
+ "model.layers.29.self_attn.q_proj.weight": "pytorch_model-00006-of-00006.bin",
215
+ "model.layers.29.self_attn.v_proj.weight": "pytorch_model-00006-of-00006.bin",
216
+ "model.layers.3.input_layernorm.weight": "pytorch_model-00001-of-00006.bin",
217
+ "model.layers.3.mlp.down_proj.weight": "pytorch_model-00001-of-00006.bin",
218
+ "model.layers.3.mlp.gate_proj.weight": "pytorch_model-00001-of-00006.bin",
219
+ "model.layers.3.mlp.up_proj.weight": "pytorch_model-00001-of-00006.bin",
220
+ "model.layers.3.post_attention_layernorm.weight": "pytorch_model-00001-of-00006.bin",
221
+ "model.layers.3.self_attn.k_proj.weight": "pytorch_model-00001-of-00006.bin",
222
+ "model.layers.3.self_attn.o_proj.weight": "pytorch_model-00001-of-00006.bin",
223
+ "model.layers.3.self_attn.q_proj.weight": "pytorch_model-00001-of-00006.bin",
224
+ "model.layers.3.self_attn.v_proj.weight": "pytorch_model-00001-of-00006.bin",
225
+ "model.layers.30.input_layernorm.weight": "pytorch_model-00006-of-00006.bin",
226
+ "model.layers.30.mlp.down_proj.weight": "pytorch_model-00006-of-00006.bin",
227
+ "model.layers.30.mlp.gate_proj.weight": "pytorch_model-00006-of-00006.bin",
228
+ "model.layers.30.mlp.up_proj.weight": "pytorch_model-00006-of-00006.bin",
229
+ "model.layers.30.post_attention_layernorm.weight": "pytorch_model-00006-of-00006.bin",
230
+ "model.layers.30.self_attn.k_proj.weight": "pytorch_model-00006-of-00006.bin",
231
+ "model.layers.30.self_attn.o_proj.weight": "pytorch_model-00006-of-00006.bin",
232
+ "model.layers.30.self_attn.q_proj.weight": "pytorch_model-00006-of-00006.bin",
233
+ "model.layers.30.self_attn.v_proj.weight": "pytorch_model-00006-of-00006.bin",
234
+ "model.layers.31.input_layernorm.weight": "pytorch_model-00006-of-00006.bin",
235
+ "model.layers.31.mlp.down_proj.weight": "pytorch_model-00006-of-00006.bin",
236
+ "model.layers.31.mlp.gate_proj.weight": "pytorch_model-00006-of-00006.bin",
237
+ "model.layers.31.mlp.up_proj.weight": "pytorch_model-00006-of-00006.bin",
238
+ "model.layers.31.post_attention_layernorm.weight": "pytorch_model-00006-of-00006.bin",
239
+ "model.layers.31.self_attn.k_proj.weight": "pytorch_model-00006-of-00006.bin",
240
+ "model.layers.31.self_attn.o_proj.weight": "pytorch_model-00006-of-00006.bin",
241
+ "model.layers.31.self_attn.q_proj.weight": "pytorch_model-00006-of-00006.bin",
242
+ "model.layers.31.self_attn.v_proj.weight": "pytorch_model-00006-of-00006.bin",
243
+ "model.layers.4.input_layernorm.weight": "pytorch_model-00002-of-00006.bin",
244
+ "model.layers.4.mlp.down_proj.weight": "pytorch_model-00002-of-00006.bin",
245
+ "model.layers.4.mlp.gate_proj.weight": "pytorch_model-00001-of-00006.bin",
246
+ "model.layers.4.mlp.up_proj.weight": "pytorch_model-00001-of-00006.bin",
247
+ "model.layers.4.post_attention_layernorm.weight": "pytorch_model-00002-of-00006.bin",
248
+ "model.layers.4.self_attn.k_proj.weight": "pytorch_model-00001-of-00006.bin",
249
+ "model.layers.4.self_attn.o_proj.weight": "pytorch_model-00001-of-00006.bin",
250
+ "model.layers.4.self_attn.q_proj.weight": "pytorch_model-00001-of-00006.bin",
251
+ "model.layers.4.self_attn.v_proj.weight": "pytorch_model-00001-of-00006.bin",
252
+ "model.layers.5.input_layernorm.weight": "pytorch_model-00002-of-00006.bin",
253
+ "model.layers.5.mlp.down_proj.weight": "pytorch_model-00002-of-00006.bin",
254
+ "model.layers.5.mlp.gate_proj.weight": "pytorch_model-00002-of-00006.bin",
255
+ "model.layers.5.mlp.up_proj.weight": "pytorch_model-00002-of-00006.bin",
256
+ "model.layers.5.post_attention_layernorm.weight": "pytorch_model-00002-of-00006.bin",
257
+ "model.layers.5.self_attn.k_proj.weight": "pytorch_model-00002-of-00006.bin",
258
+ "model.layers.5.self_attn.o_proj.weight": "pytorch_model-00002-of-00006.bin",
259
+ "model.layers.5.self_attn.q_proj.weight": "pytorch_model-00002-of-00006.bin",
260
+ "model.layers.5.self_attn.v_proj.weight": "pytorch_model-00002-of-00006.bin",
261
+ "model.layers.6.input_layernorm.weight": "pytorch_model-00002-of-00006.bin",
262
+ "model.layers.6.mlp.down_proj.weight": "pytorch_model-00002-of-00006.bin",
263
+ "model.layers.6.mlp.gate_proj.weight": "pytorch_model-00002-of-00006.bin",
264
+ "model.layers.6.mlp.up_proj.weight": "pytorch_model-00002-of-00006.bin",
265
+ "model.layers.6.post_attention_layernorm.weight": "pytorch_model-00002-of-00006.bin",
266
+ "model.layers.6.self_attn.k_proj.weight": "pytorch_model-00002-of-00006.bin",
267
+ "model.layers.6.self_attn.o_proj.weight": "pytorch_model-00002-of-00006.bin",
268
+ "model.layers.6.self_attn.q_proj.weight": "pytorch_model-00002-of-00006.bin",
269
+ "model.layers.6.self_attn.v_proj.weight": "pytorch_model-00002-of-00006.bin",
270
+ "model.layers.7.input_layernorm.weight": "pytorch_model-00002-of-00006.bin",
271
+ "model.layers.7.mlp.down_proj.weight": "pytorch_model-00002-of-00006.bin",
272
+ "model.layers.7.mlp.gate_proj.weight": "pytorch_model-00002-of-00006.bin",
273
+ "model.layers.7.mlp.up_proj.weight": "pytorch_model-00002-of-00006.bin",
274
+ "model.layers.7.post_attention_layernorm.weight": "pytorch_model-00002-of-00006.bin",
275
+ "model.layers.7.self_attn.k_proj.weight": "pytorch_model-00002-of-00006.bin",
276
+ "model.layers.7.self_attn.o_proj.weight": "pytorch_model-00002-of-00006.bin",
277
+ "model.layers.7.self_attn.q_proj.weight": "pytorch_model-00002-of-00006.bin",
278
+ "model.layers.7.self_attn.v_proj.weight": "pytorch_model-00002-of-00006.bin",
279
+ "model.layers.8.input_layernorm.weight": "pytorch_model-00002-of-00006.bin",
280
+ "model.layers.8.mlp.down_proj.weight": "pytorch_model-00002-of-00006.bin",
281
+ "model.layers.8.mlp.gate_proj.weight": "pytorch_model-00002-of-00006.bin",
282
+ "model.layers.8.mlp.up_proj.weight": "pytorch_model-00002-of-00006.bin",
283
+ "model.layers.8.post_attention_layernorm.weight": "pytorch_model-00002-of-00006.bin",
284
+ "model.layers.8.self_attn.k_proj.weight": "pytorch_model-00002-of-00006.bin",
285
+ "model.layers.8.self_attn.o_proj.weight": "pytorch_model-00002-of-00006.bin",
286
+ "model.layers.8.self_attn.q_proj.weight": "pytorch_model-00002-of-00006.bin",
287
+ "model.layers.8.self_attn.v_proj.weight": "pytorch_model-00002-of-00006.bin",
288
+ "model.layers.9.input_layernorm.weight": "pytorch_model-00002-of-00006.bin",
289
+ "model.layers.9.mlp.down_proj.weight": "pytorch_model-00002-of-00006.bin",
290
+ "model.layers.9.mlp.gate_proj.weight": "pytorch_model-00002-of-00006.bin",
291
+ "model.layers.9.mlp.up_proj.weight": "pytorch_model-00002-of-00006.bin",
292
+ "model.layers.9.post_attention_layernorm.weight": "pytorch_model-00002-of-00006.bin",
293
+ "model.layers.9.self_attn.k_proj.weight": "pytorch_model-00002-of-00006.bin",
294
+ "model.layers.9.self_attn.o_proj.weight": "pytorch_model-00002-of-00006.bin",
295
+ "model.layers.9.self_attn.q_proj.weight": "pytorch_model-00002-of-00006.bin",
296
+ "model.layers.9.self_attn.v_proj.weight": "pytorch_model-00002-of-00006.bin",
297
+ "model.norm.weight": "pytorch_model-00006-of-00006.bin"
298
+ }
299
+ }
special_tokens_map.json ADDED
@@ -0,0 +1,51 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "bos_token": {
3
+ "content": "<s>",
4
+ "lstrip": false,
5
+ "normalized": true,
6
+ "rstrip": false,
7
+ "single_word": false
8
+ },
9
+ "cls_token": {
10
+ "content": "<s>",
11
+ "lstrip": false,
12
+ "normalized": true,
13
+ "rstrip": false,
14
+ "single_word": false
15
+ },
16
+ "eos_token": {
17
+ "content": "</s>",
18
+ "lstrip": false,
19
+ "normalized": true,
20
+ "rstrip": false,
21
+ "single_word": false
22
+ },
23
+ "mask_token": {
24
+ "content": "<unk>",
25
+ "lstrip": false,
26
+ "normalized": true,
27
+ "rstrip": false,
28
+ "single_word": false
29
+ },
30
+ "pad_token": {
31
+ "content": "</s>",
32
+ "lstrip": false,
33
+ "normalized": true,
34
+ "rstrip": false,
35
+ "single_word": false
36
+ },
37
+ "sep_token": {
38
+ "content": "<s>",
39
+ "lstrip": false,
40
+ "normalized": true,
41
+ "rstrip": false,
42
+ "single_word": false
43
+ },
44
+ "unk_token": {
45
+ "content": "<unk>",
46
+ "lstrip": false,
47
+ "normalized": true,
48
+ "rstrip": false,
49
+ "single_word": false
50
+ }
51
+ }
tokenizer.json ADDED
The diff for this file is too large to render. See raw diff
 
tokenizer_config.json ADDED
@@ -0,0 +1,42 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "add_bos_token": true,
3
+ "add_eos_token": false,
4
+ "added_tokens_decoder": {
5
+ "0": {
6
+ "content": "<unk>",
7
+ "lstrip": false,
8
+ "normalized": true,
9
+ "rstrip": false,
10
+ "single_word": false,
11
+ "special": true
12
+ },
13
+ "1": {
14
+ "content": "<s>",
15
+ "lstrip": false,
16
+ "normalized": true,
17
+ "rstrip": false,
18
+ "single_word": false,
19
+ "special": true
20
+ },
21
+ "2": {
22
+ "content": "</s>",
23
+ "lstrip": false,
24
+ "normalized": true,
25
+ "rstrip": false,
26
+ "single_word": false,
27
+ "special": true
28
+ }
29
+ },
30
+ "bos_token": "<s>",
31
+ "clean_up_tokenization_spaces": false,
32
+ "cls_token": "<s>",
33
+ "eos_token": "</s>",
34
+ "legacy": true,
35
+ "mask_token": "<unk>",
36
+ "model_max_length": 32768,
37
+ "pad_token": "</s>",
38
+ "sep_token": "<s>",
39
+ "tokenizer_class": "LlamaTokenizerFast",
40
+ "unk_token": "<unk>",
41
+ "use_default_system_prompt": false
42
+ }
upos.py ADDED
@@ -0,0 +1,80 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from transformers import TokenClassificationPipeline,MistralModel,MistralPreTrainedModel
2
+ from transformers.modeling_outputs import TokenClassifierOutput
3
+
4
+ class BellmanFordTokenClassificationPipeline(TokenClassificationPipeline):
5
+ def __init__(self,**kwargs):
6
+ import numpy
7
+ super().__init__(**kwargs)
8
+ x=self.model.config.label2id
9
+ y=[k for k in x if not k.startswith("I-")]
10
+ self.transition=numpy.full((len(x),len(x)),numpy.nan)
11
+ for k,v in x.items():
12
+ for j in ["I-"+k[2:]] if k.startswith("B-") else [k]+y if k.startswith("I-") else y:
13
+ self.transition[v,x[j]]=0
14
+ def check_model_type(self,supported_models):
15
+ pass
16
+ def postprocess(self,model_outputs,**kwargs):
17
+ import numpy
18
+ if "logits" not in model_outputs:
19
+ return self.postprocess(model_outputs[0],**kwargs)
20
+ m=model_outputs["logits"][0].numpy()
21
+ e=numpy.exp(m-numpy.max(m,axis=-1,keepdims=True))
22
+ z=e/e.sum(axis=-1,keepdims=True)
23
+ for i in range(m.shape[0]-1,0,-1):
24
+ m[i-1]+=numpy.nanmax(m[i]+self.transition,axis=1)
25
+ k=[numpy.nanargmax(m[0])]
26
+ for i in range(1,m.shape[0]):
27
+ k.append(numpy.nanargmax(m[i]+self.transition[k[-1]]))
28
+ w=[{"entity":self.model.config.id2label[j],"start":s,"end":e,"score":z[i,j]} for i,((s,e),j) in enumerate(zip(model_outputs["offset_mapping"][0].tolist(),k)) if s<e]
29
+ if "aggregation_strategy" in kwargs and kwargs["aggregation_strategy"]!="none":
30
+ for i,t in reversed(list(enumerate(w))):
31
+ p=t.pop("entity")
32
+ if p.startswith("I-"):
33
+ w[i-1]["score"]=min(w[i-1]["score"],t["score"])
34
+ w[i-1]["end"]=w.pop(i)["end"]
35
+ elif p.startswith("B-"):
36
+ t["entity_group"]=p[2:]
37
+ else:
38
+ t["entity_group"]=p
39
+ for t in w:
40
+ t["text"]=model_outputs["sentence"][t["start"]:t["end"]]
41
+ return w
42
+
43
+ class RawTokenClassificationPipeline(TokenClassificationPipeline):
44
+ def check_model_type(self,supported_models):
45
+ pass
46
+
47
+ class MistralForTokenClassification(MistralPreTrainedModel):
48
+ def __init__(self,config):
49
+ from torch import nn
50
+ super().__init__(config)
51
+ self.num_labels=config.num_labels
52
+ self.model=MistralModel(config)
53
+ if hasattr(config,"classifier_dropout") and config.classifier_dropout is not None:
54
+ classifier_dropout=config.classifier_dropout
55
+ elif hasattr(config,"hidden_dropout") and config.hidden_dropout is not None:
56
+ classifier_dropout=config.hidden_dropout
57
+ else:
58
+ classifier_dropout=0.1
59
+ self.dropout=nn.Dropout(classifier_dropout)
60
+ self.classifier=nn.Linear(config.hidden_size,config.num_labels)
61
+ self.post_init()
62
+ def get_input_embeddings(self):
63
+ return self.model.embed_tokens
64
+ def set_input_embeddings(self,value):
65
+ self.model.embed_tokens=value
66
+ def forward(self,input_ids=None,past_key_values=None,attention_mask=None,position_ids=None,inputs_embeds=None,labels=None,use_cache=None,output_attentions=None,output_hidden_states=None,return_dict=None):
67
+ return_dict=return_dict if return_dict is not None else self.config.use_return_dict
68
+ transformer_outputs=self.model(input_ids,past_key_values=past_key_values,attention_mask=attention_mask,position_ids=position_ids,inputs_embeds=inputs_embeds,use_cache=use_cache,output_attentions=output_attentions,output_hidden_states=output_hidden_states,return_dict=return_dict)
69
+ hidden_states=transformer_outputs[0]
70
+ hidden_states=self.dropout(hidden_states)
71
+ logits=self.classifier(hidden_states)
72
+ loss=None
73
+ if labels is not None:
74
+ from torch import nn
75
+ loss_fct=nn.CrossEntropyLoss()
76
+ loss=loss_fct(logits.view(-1,self.num_labels),labels.view(-1))
77
+ if not return_dict:
78
+ output=(logits,)+transformer_outputs[2:]
79
+ return ((loss,)+output) if loss is not None else output
80
+ return TokenClassifierOutput(loss=loss,logits=logits,hidden_states=transformer_outputs.hidden_states,attentions=transformer_outputs.attentions)