KoichiYasuoka
commited on
Commit
•
17f8b89
1
Parent(s):
42e4985
initial release
Browse files- README.md +29 -0
- config.json +162 -0
- maker.sh +133 -0
- pytorch_model-00001-of-00006.bin +3 -0
- pytorch_model-00002-of-00006.bin +3 -0
- pytorch_model-00003-of-00006.bin +3 -0
- pytorch_model-00004-of-00006.bin +3 -0
- pytorch_model-00005-of-00006.bin +3 -0
- pytorch_model-00006-of-00006.bin +3 -0
- pytorch_model.bin.index.json +299 -0
- special_tokens_map.json +51 -0
- tokenizer.json +0 -0
- tokenizer_config.json +42 -0
- upos.py +76 -0
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 |
+
# Swallow-MS-7b-char-upos
|
17 |
+
|
18 |
+
## Model Description
|
19 |
+
|
20 |
+
This is a Mistral model for POS-tagging, derived from [Swallow-MS-7b-v0.1](https://huggingface.co/tokyotech-llm/Swallow-MS-7b-v0.1). 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/Swallow-MS-7b-char-upos",trust_remote_code=True,aggregation_strategy="simple")
|
27 |
+
print(nlp("国境の長いトンネルを抜けると雪国であった。"))
|
28 |
+
```
|
29 |
+
|
config.json
ADDED
@@ -0,0 +1,162 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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 |
+
},
|
17 |
+
"eos_token_id": 2,
|
18 |
+
"hidden_act": "silu",
|
19 |
+
"hidden_size": 4096,
|
20 |
+
"id2label": {
|
21 |
+
"0": "ADJ",
|
22 |
+
"1": "B-ADJ",
|
23 |
+
"2": "I-ADJ",
|
24 |
+
"3": "ADJ|Polarity=Neg",
|
25 |
+
"4": "B-ADJ|Polarity=Neg",
|
26 |
+
"5": "I-ADJ|Polarity=Neg",
|
27 |
+
"6": "ADP",
|
28 |
+
"7": "B-ADP",
|
29 |
+
"8": "I-ADP",
|
30 |
+
"9": "ADV",
|
31 |
+
"10": "B-ADV",
|
32 |
+
"11": "I-ADV",
|
33 |
+
"12": "AUX",
|
34 |
+
"13": "B-AUX",
|
35 |
+
"14": "I-AUX",
|
36 |
+
"15": "AUX|Polarity=Neg",
|
37 |
+
"16": "B-AUX|Polarity=Neg",
|
38 |
+
"17": "I-AUX|Polarity=Neg",
|
39 |
+
"18": "CCONJ",
|
40 |
+
"19": "B-CCONJ",
|
41 |
+
"20": "I-CCONJ",
|
42 |
+
"21": "DET",
|
43 |
+
"22": "B-DET",
|
44 |
+
"23": "I-DET",
|
45 |
+
"24": "INTJ",
|
46 |
+
"25": "B-INTJ",
|
47 |
+
"26": "I-INTJ",
|
48 |
+
"27": "NOUN",
|
49 |
+
"28": "B-NOUN",
|
50 |
+
"29": "I-NOUN",
|
51 |
+
"30": "NOUN|Polarity=Neg",
|
52 |
+
"31": "B-NOUN|Polarity=Neg",
|
53 |
+
"32": "I-NOUN|Polarity=Neg",
|
54 |
+
"33": "NUM",
|
55 |
+
"34": "B-NUM",
|
56 |
+
"35": "I-NUM",
|
57 |
+
"36": "PART",
|
58 |
+
"37": "B-PART",
|
59 |
+
"38": "I-PART",
|
60 |
+
"39": "PRON",
|
61 |
+
"40": "B-PRON",
|
62 |
+
"41": "I-PRON",
|
63 |
+
"42": "PROPN",
|
64 |
+
"43": "B-PROPN",
|
65 |
+
"44": "I-PROPN",
|
66 |
+
"45": "PUNCT",
|
67 |
+
"46": "B-PUNCT",
|
68 |
+
"47": "I-PUNCT",
|
69 |
+
"48": "SCONJ",
|
70 |
+
"49": "B-SCONJ",
|
71 |
+
"50": "I-SCONJ",
|
72 |
+
"51": "SYM",
|
73 |
+
"52": "B-SYM",
|
74 |
+
"53": "I-SYM",
|
75 |
+
"54": "VERB",
|
76 |
+
"55": "B-VERB",
|
77 |
+
"56": "I-VERB",
|
78 |
+
"57": "X",
|
79 |
+
"58": "B-X",
|
80 |
+
"59": "I-X"
|
81 |
+
},
|
82 |
+
"initializer_range": 0.02,
|
83 |
+
"intermediate_size": 14336,
|
84 |
+
"label2id": {
|
85 |
+
"ADJ": 0,
|
86 |
+
"ADJ|Polarity=Neg": 3,
|
87 |
+
"ADP": 6,
|
88 |
+
"ADV": 9,
|
89 |
+
"AUX": 12,
|
90 |
+
"AUX|Polarity=Neg": 15,
|
91 |
+
"B-ADJ": 1,
|
92 |
+
"B-ADJ|Polarity=Neg": 4,
|
93 |
+
"B-ADP": 7,
|
94 |
+
"B-ADV": 10,
|
95 |
+
"B-AUX": 13,
|
96 |
+
"B-AUX|Polarity=Neg": 16,
|
97 |
+
"B-CCONJ": 19,
|
98 |
+
"B-DET": 22,
|
99 |
+
"B-INTJ": 25,
|
100 |
+
"B-NOUN": 28,
|
101 |
+
"B-NOUN|Polarity=Neg": 31,
|
102 |
+
"B-NUM": 34,
|
103 |
+
"B-PART": 37,
|
104 |
+
"B-PRON": 40,
|
105 |
+
"B-PROPN": 43,
|
106 |
+
"B-PUNCT": 46,
|
107 |
+
"B-SCONJ": 49,
|
108 |
+
"B-SYM": 52,
|
109 |
+
"B-VERB": 55,
|
110 |
+
"B-X": 58,
|
111 |
+
"CCONJ": 18,
|
112 |
+
"DET": 21,
|
113 |
+
"I-ADJ": 2,
|
114 |
+
"I-ADJ|Polarity=Neg": 5,
|
115 |
+
"I-ADP": 8,
|
116 |
+
"I-ADV": 11,
|
117 |
+
"I-AUX": 14,
|
118 |
+
"I-AUX|Polarity=Neg": 17,
|
119 |
+
"I-CCONJ": 20,
|
120 |
+
"I-DET": 23,
|
121 |
+
"I-INTJ": 26,
|
122 |
+
"I-NOUN": 29,
|
123 |
+
"I-NOUN|Polarity=Neg": 32,
|
124 |
+
"I-NUM": 35,
|
125 |
+
"I-PART": 38,
|
126 |
+
"I-PRON": 41,
|
127 |
+
"I-PROPN": 44,
|
128 |
+
"I-PUNCT": 47,
|
129 |
+
"I-SCONJ": 50,
|
130 |
+
"I-SYM": 53,
|
131 |
+
"I-VERB": 56,
|
132 |
+
"I-X": 59,
|
133 |
+
"INTJ": 24,
|
134 |
+
"NOUN": 27,
|
135 |
+
"NOUN|Polarity=Neg": 30,
|
136 |
+
"NUM": 33,
|
137 |
+
"PART": 36,
|
138 |
+
"PRON": 39,
|
139 |
+
"PROPN": 42,
|
140 |
+
"PUNCT": 45,
|
141 |
+
"SCONJ": 48,
|
142 |
+
"SYM": 51,
|
143 |
+
"VERB": 54,
|
144 |
+
"X": 57
|
145 |
+
},
|
146 |
+
"max_position_embeddings": 4096,
|
147 |
+
"model_type": "mistral",
|
148 |
+
"num_attention_heads": 32,
|
149 |
+
"num_hidden_layers": 32,
|
150 |
+
"num_key_value_heads": 8,
|
151 |
+
"pretraining_tp": 1,
|
152 |
+
"rms_norm_eps": 1e-05,
|
153 |
+
"rope_scaling": null,
|
154 |
+
"rope_theta": 10000.0,
|
155 |
+
"sliding_window": 4096,
|
156 |
+
"tie_word_embeddings": false,
|
157 |
+
"tokenizer_class": "LlamaTokenizerFast",
|
158 |
+
"torch_dtype": "float32",
|
159 |
+
"transformers_version": "4.41.2",
|
160 |
+
"use_cache": true,
|
161 |
+
"vocab_size": 43317
|
162 |
+
}
|
maker.sh
ADDED
@@ -0,0 +1,133 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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 |
+
curl -L https://huggingface.co/KoichiYasuoka/Swallow-MS-7b-upos/resolve/main/tokenizer.json | env LANG=ja_JP.utf8 egrep -v '"[ぁ-ん] [ぁ-ん]",$' > newtokenizer.json
|
4 |
+
|
5 |
+
TMP=./maker$$.py
|
6 |
+
cat << 'EOF' > $TMP
|
7 |
+
#! /usr/bin/env deepspeed
|
8 |
+
src="KoichiYasuoka/Swallow-MS-7b-upos"
|
9 |
+
tgt="KoichiYasuoka/Swallow-MS-7b-char-upos"
|
10 |
+
from transformers import LlamaTokenizerFast,MistralModel,MistralPreTrainedModel,AutoConfig,DataCollatorForTokenClassification,TrainingArguments,Trainer
|
11 |
+
from transformers.modeling_outputs import TokenClassifierOutput
|
12 |
+
|
13 |
+
class MistralForTokenClassification(MistralPreTrainedModel):
|
14 |
+
def __init__(self,config):
|
15 |
+
from torch import nn
|
16 |
+
super().__init__(config)
|
17 |
+
self.num_labels=config.num_labels
|
18 |
+
self.model=MistralModel(config)
|
19 |
+
if hasattr(config,"classifier_dropout") and config.classifier_dropout is not None:
|
20 |
+
classifier_dropout=config.classifier_dropout
|
21 |
+
elif hasattr(config,"hidden_dropout") and config.hidden_dropout is not None:
|
22 |
+
classifier_dropout=config.hidden_dropout
|
23 |
+
else:
|
24 |
+
classifier_dropout=0.1
|
25 |
+
self.dropout=nn.Dropout(classifier_dropout)
|
26 |
+
self.classifier=nn.Linear(config.hidden_size,config.num_labels)
|
27 |
+
self.post_init()
|
28 |
+
def get_input_embeddings(self):
|
29 |
+
return self.model.embed_tokens
|
30 |
+
def set_input_embeddings(self,value):
|
31 |
+
self.model.embed_tokens=value
|
32 |
+
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):
|
33 |
+
return_dict=return_dict if return_dict is not None else self.config.use_return_dict
|
34 |
+
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)
|
35 |
+
hidden_states=transformer_outputs[0]
|
36 |
+
hidden_states=self.dropout(hidden_states)
|
37 |
+
logits=self.classifier(hidden_states)
|
38 |
+
loss=None
|
39 |
+
if labels is not None:
|
40 |
+
from torch import nn
|
41 |
+
loss_fct=nn.CrossEntropyLoss()
|
42 |
+
loss=loss_fct(logits.view(-1,self.num_labels),labels.view(-1))
|
43 |
+
if not return_dict:
|
44 |
+
output=(logits,)+transformer_outputs[1:]
|
45 |
+
return ((loss,)+output) if loss is not None else output
|
46 |
+
return TokenClassifierOutput(loss=loss,logits=logits,hidden_states=transformer_outputs.hidden_states,attentions=transformer_outputs.attentions)
|
47 |
+
|
48 |
+
class UPOSFileDataset(object):
|
49 |
+
def __init__(self,conllu,tokenizer):
|
50 |
+
self.conllu=open(conllu,"r",encoding="utf-8")
|
51 |
+
self.tokenizer=tokenizer
|
52 |
+
self.seeks=[0]
|
53 |
+
self.multiword={}
|
54 |
+
label=set(["SYM"])
|
55 |
+
s=self.conllu.readline()
|
56 |
+
while s!="":
|
57 |
+
if s=="\n":
|
58 |
+
self.seeks.append(self.conllu.tell())
|
59 |
+
else:
|
60 |
+
w=s.split("\t")
|
61 |
+
if len(w)==10:
|
62 |
+
if w[0].isdecimal():
|
63 |
+
label.add(w[3] if w[5]=="_" else w[3]+"|"+w[5])
|
64 |
+
elif w[0].find("-")>0:
|
65 |
+
t=w[0].split("-")
|
66 |
+
f,j,k=w[1],[],[]
|
67 |
+
for i in range(int(t[0]),int(t[1])+1):
|
68 |
+
w=self.conllu.readline().split("\t")
|
69 |
+
j.append(w[3] if w[5]=="_" else w[3]+"|"+w[5])
|
70 |
+
k.append(w[1])
|
71 |
+
p="+".join(j)
|
72 |
+
label.add(p)
|
73 |
+
if p in self.multiword:
|
74 |
+
self.multiword[p][f]=list(k)
|
75 |
+
else:
|
76 |
+
self.multiword[p]={f:list(k)}
|
77 |
+
s=self.conllu.readline()
|
78 |
+
lid={}
|
79 |
+
for i,l in enumerate(sorted(label)):
|
80 |
+
lid[l],lid["B-"+l],lid["I-"+l]=i*3,i*3+1,i*3+2
|
81 |
+
self.label2id=lid
|
82 |
+
def __call__(*args):
|
83 |
+
lid={l:i for i,l in enumerate(sorted(set(sum([list(t.label2id) for t in args],[]))))}
|
84 |
+
for t in args:
|
85 |
+
t.label2id=lid
|
86 |
+
return lid
|
87 |
+
def __del__(self):
|
88 |
+
self.conllu.close()
|
89 |
+
__len__=lambda self:len(self.seeks)-1
|
90 |
+
def __getitem__(self,i):
|
91 |
+
self.conllu.seek(self.seeks[i])
|
92 |
+
form,upos=[],[]
|
93 |
+
while self.conllu.tell()<self.seeks[i+1]:
|
94 |
+
w=self.conllu.readline().split("\t")
|
95 |
+
if len(w)==10:
|
96 |
+
form.append(w[1])
|
97 |
+
if w[0].isdecimal():
|
98 |
+
upos.append(w[3] if w[5]=="_" else w[3]+"|"+w[5])
|
99 |
+
elif w[0].find("-")>0:
|
100 |
+
t=w[0].split("-")
|
101 |
+
u=[]
|
102 |
+
for j in range(int(t[0]),int(t[1])+1):
|
103 |
+
k=self.conllu.readline().split("\t")
|
104 |
+
u.append(k[3] if k[5]=="_" else k[3]+"|"+k[5])
|
105 |
+
upos.append("+".join(u))
|
106 |
+
v=self.tokenizer(form,add_special_tokens=False)
|
107 |
+
i,u=[],[]
|
108 |
+
for j,(x,y) in enumerate(zip(v["input_ids"],upos)):
|
109 |
+
if x!=[]:
|
110 |
+
i+=x
|
111 |
+
u+=[y] if len(x)==1 else ["B-"+y]+["I-"+y]*(len(x)-1)
|
112 |
+
if len(i)<self.tokenizer.model_max_length-3:
|
113 |
+
ids=[self.tokenizer.cls_token_id]+i+[self.tokenizer.sep_token_id]
|
114 |
+
upos=["SYM"]+u+["SYM"]
|
115 |
+
else:
|
116 |
+
ids=i[0:self.tokenizer.model_max_length-2]
|
117 |
+
upos=u[0:self.tokenizer.model_max_length-2]
|
118 |
+
return {"input_ids":ids,"labels":[self.label2id[t] for t in upos]}
|
119 |
+
|
120 |
+
tkz=LlamaTokenizerFast.from_pretrained(src,tokenizer_file="newtokenizer.json")
|
121 |
+
trainDS=UPOSFileDataset("ja_gsd_modern.conllu",tkz)
|
122 |
+
lid=trainDS.label2id
|
123 |
+
cfg=AutoConfig.from_pretrained(src,num_labels=len(lid),label2id=lid,id2label={i:l for l,i in lid.items()},ignore_mismatched_sizes=True)
|
124 |
+
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}}
|
125 |
+
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)
|
126 |
+
trn=Trainer(args=arg,data_collator=DataCollatorForTokenClassification(tkz),model=MistralForTokenClassification.from_pretrained(src,config=cfg,ignore_mismatched_sizes=True),train_dataset=trainDS)
|
127 |
+
trn.train()
|
128 |
+
trn.save_model(tgt)
|
129 |
+
tkz.save_pretrained(tgt)
|
130 |
+
EOF
|
131 |
+
chmod 755 $TMP
|
132 |
+
$TMP
|
133 |
+
exit
|
pytorch_model-00001-of-00006.bin
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:5cb0ba6633ea74b22049cea79e435b5a3ad19649a4ff9f48743567b64c902c13
|
3 |
+
size 4837046848
|
pytorch_model-00002-of-00006.bin
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:20f447a34503f5ec4003bc9cfbe6c1abafffd48d0a4ce49548563372be559d79
|
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:57e46f1de15876e55c70f5cd7f3d1f01bd5bb4aeaeb34bee192bf652605dedb9
|
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:3c18cd5ab8290dcc966550409a6c550d4ce1df15192cbaf3be94c881ec0dcaa6
|
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:5ae2b56e85c3a9751dce1784b6f4af3d5bdfac7a45cf357e77709a2145a33a88
|
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:1596ed873cf4ca299b38404224d58504ad40b0e3936e8ed9196a8670709e9ef9
|
3 |
+
size 3960601264
|
pytorch_model.bin.index.json
ADDED
@@ -0,0 +1,299 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"metadata": {
|
3 |
+
"total_size": 28629041392
|
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": false,
|
6 |
+
"rstrip": false,
|
7 |
+
"single_word": false
|
8 |
+
},
|
9 |
+
"cls_token": {
|
10 |
+
"content": "<s>",
|
11 |
+
"lstrip": false,
|
12 |
+
"normalized": false,
|
13 |
+
"rstrip": false,
|
14 |
+
"single_word": false
|
15 |
+
},
|
16 |
+
"eos_token": {
|
17 |
+
"content": "</s>",
|
18 |
+
"lstrip": false,
|
19 |
+
"normalized": false,
|
20 |
+
"rstrip": false,
|
21 |
+
"single_word": false
|
22 |
+
},
|
23 |
+
"mask_token": {
|
24 |
+
"content": "<unk>",
|
25 |
+
"lstrip": false,
|
26 |
+
"normalized": false,
|
27 |
+
"rstrip": false,
|
28 |
+
"single_word": false
|
29 |
+
},
|
30 |
+
"pad_token": {
|
31 |
+
"content": "</s>",
|
32 |
+
"lstrip": false,
|
33 |
+
"normalized": false,
|
34 |
+
"rstrip": false,
|
35 |
+
"single_word": false
|
36 |
+
},
|
37 |
+
"sep_token": {
|
38 |
+
"content": "<s>",
|
39 |
+
"lstrip": false,
|
40 |
+
"normalized": false,
|
41 |
+
"rstrip": false,
|
42 |
+
"single_word": false
|
43 |
+
},
|
44 |
+
"unk_token": {
|
45 |
+
"content": "<unk>",
|
46 |
+
"lstrip": false,
|
47 |
+
"normalized": false,
|
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": false,
|
9 |
+
"rstrip": false,
|
10 |
+
"single_word": false,
|
11 |
+
"special": true
|
12 |
+
},
|
13 |
+
"1": {
|
14 |
+
"content": "<s>",
|
15 |
+
"lstrip": false,
|
16 |
+
"normalized": false,
|
17 |
+
"rstrip": false,
|
18 |
+
"single_word": false,
|
19 |
+
"special": true
|
20 |
+
},
|
21 |
+
"2": {
|
22 |
+
"content": "</s>",
|
23 |
+
"lstrip": false,
|
24 |
+
"normalized": false,
|
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": 4096,
|
37 |
+
"pad_token": "</s>",
|
38 |
+
"sep_token": "<s>",
|
39 |
+
"tokenizer_class": "LlamaTokenizer",
|
40 |
+
"unk_token": "<unk>",
|
41 |
+
"use_default_system_prompt": false
|
42 |
+
}
|
upos.py
ADDED
@@ -0,0 +1,76 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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 MistralForTokenClassification(MistralPreTrainedModel):
|
44 |
+
def __init__(self,config):
|
45 |
+
from torch import nn
|
46 |
+
super().__init__(config)
|
47 |
+
self.num_labels=config.num_labels
|
48 |
+
self.model=MistralModel(config)
|
49 |
+
if hasattr(config,"classifier_dropout") and config.classifier_dropout is not None:
|
50 |
+
classifier_dropout=config.classifier_dropout
|
51 |
+
elif hasattr(config,"hidden_dropout") and config.hidden_dropout is not None:
|
52 |
+
classifier_dropout=config.hidden_dropout
|
53 |
+
else:
|
54 |
+
classifier_dropout=0.1
|
55 |
+
self.dropout=nn.Dropout(classifier_dropout)
|
56 |
+
self.classifier=nn.Linear(config.hidden_size,config.num_labels)
|
57 |
+
self.post_init()
|
58 |
+
def get_input_embeddings(self):
|
59 |
+
return self.model.embed_tokens
|
60 |
+
def set_input_embeddings(self,value):
|
61 |
+
self.model.embed_tokens=value
|
62 |
+
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):
|
63 |
+
return_dict=return_dict if return_dict is not None else self.config.use_return_dict
|
64 |
+
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)
|
65 |
+
hidden_states=transformer_outputs[0]
|
66 |
+
hidden_states=self.dropout(hidden_states)
|
67 |
+
logits=self.classifier(hidden_states)
|
68 |
+
loss=None
|
69 |
+
if labels is not None:
|
70 |
+
from torch import nn
|
71 |
+
loss_fct=nn.CrossEntropyLoss()
|
72 |
+
loss=loss_fct(logits.view(-1,self.num_labels),labels.view(-1))
|
73 |
+
if not return_dict:
|
74 |
+
output=(logits,)+transformer_outputs[2:]
|
75 |
+
return ((loss,)+output) if loss is not None else output
|
76 |
+
return TokenClassifierOutput(loss=loss,logits=logits,hidden_states=transformer_outputs.hidden_states,attentions=transformer_outputs.attentions)
|