KoichiYasuoka commited on
Commit
eb373e8
1 Parent(s): 5df1f02

initial release

Browse files
README.md ADDED
@@ -0,0 +1,30 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ language:
3
+ - "ja"
4
+ tags:
5
+ - "japanese"
6
+ - "token-classification"
7
+ - "pos"
8
+ base_model: llm-jp/llm-jp-1.3b-v1.0
9
+ datasets:
10
+ - "universal_dependencies"
11
+ license: "apache-2.0"
12
+ pipeline_tag: "token-classification"
13
+ widget:
14
+ - text: "国境の長いトンネルを抜けると雪国であった。"
15
+ ---
16
+
17
+ # llm-jp-1.3b-upos
18
+
19
+ ## Model Description
20
+
21
+ This is a GPT-2 model for POS-tagging, derived from [llm-jp-1.3b-v1.0](https://huggingface.co/llm-jp/llm-jp-1.3b-v1.0). Every short-unit-word is tagged by [UPOS](https://universaldependencies.org/u/pos/) (Universal Part-Of-Speech) and [FEATS](https://universaldependencies.org/u/feat/).
22
+
23
+ ## How to Use
24
+
25
+ ```py
26
+ from transformers import pipeline
27
+ nlp=pipeline("upos","KoichiYasuoka/llm-jp-1.3b-upos",trust_remote_code=True,aggregation_strategy="simple")
28
+ print(nlp("国境の長いトンネルを抜けると雪国であった。"))
29
+ ```
30
+
config.json ADDED
@@ -0,0 +1,164 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "activation_function": "gelu",
3
+ "architectures": [
4
+ "GPT2ForTokenClassification"
5
+ ],
6
+ "attn_pdrop": 0.1,
7
+ "bos_token_id": 7,
8
+ "custom_pipelines": {
9
+ "upos": {
10
+ "impl": "upos.BellmanFordTokenClassificationPipeline",
11
+ "pt": "AutoModelForTokenClassification"
12
+ }
13
+ },
14
+ "embd_pdrop": 0.1,
15
+ "eos_token_id": 7,
16
+ "gradient_checkpointing": false,
17
+ "id2label": {
18
+ "0": "ADJ",
19
+ "1": "B-ADJ",
20
+ "2": "I-ADJ",
21
+ "3": "ADJ|Polarity=Neg",
22
+ "4": "B-ADJ|Polarity=Neg",
23
+ "5": "I-ADJ|Polarity=Neg",
24
+ "6": "ADP",
25
+ "7": "B-ADP",
26
+ "8": "I-ADP",
27
+ "9": "ADV",
28
+ "10": "B-ADV",
29
+ "11": "I-ADV",
30
+ "12": "AUX",
31
+ "13": "B-AUX",
32
+ "14": "I-AUX",
33
+ "15": "AUX|Polarity=Neg",
34
+ "16": "B-AUX|Polarity=Neg",
35
+ "17": "I-AUX|Polarity=Neg",
36
+ "18": "CCONJ",
37
+ "19": "B-CCONJ",
38
+ "20": "I-CCONJ",
39
+ "21": "DET",
40
+ "22": "B-DET",
41
+ "23": "I-DET",
42
+ "24": "INTJ",
43
+ "25": "B-INTJ",
44
+ "26": "I-INTJ",
45
+ "27": "NOUN",
46
+ "28": "B-NOUN",
47
+ "29": "I-NOUN",
48
+ "30": "NOUN|Polarity=Neg",
49
+ "31": "B-NOUN|Polarity=Neg",
50
+ "32": "I-NOUN|Polarity=Neg",
51
+ "33": "NUM",
52
+ "34": "B-NUM",
53
+ "35": "I-NUM",
54
+ "36": "PART",
55
+ "37": "B-PART",
56
+ "38": "I-PART",
57
+ "39": "PRON",
58
+ "40": "B-PRON",
59
+ "41": "I-PRON",
60
+ "42": "PROPN",
61
+ "43": "B-PROPN",
62
+ "44": "I-PROPN",
63
+ "45": "PUNCT",
64
+ "46": "B-PUNCT",
65
+ "47": "I-PUNCT",
66
+ "48": "SCONJ",
67
+ "49": "B-SCONJ",
68
+ "50": "I-SCONJ",
69
+ "51": "SYM",
70
+ "52": "B-SYM",
71
+ "53": "I-SYM",
72
+ "54": "VERB",
73
+ "55": "B-VERB",
74
+ "56": "I-VERB",
75
+ "57": "X",
76
+ "58": "B-X",
77
+ "59": "I-X"
78
+ },
79
+ "initializer_range": 0.02,
80
+ "label2id": {
81
+ "ADJ": 0,
82
+ "ADJ|Polarity=Neg": 3,
83
+ "ADP": 6,
84
+ "ADV": 9,
85
+ "AUX": 12,
86
+ "AUX|Polarity=Neg": 15,
87
+ "B-ADJ": 1,
88
+ "B-ADJ|Polarity=Neg": 4,
89
+ "B-ADP": 7,
90
+ "B-ADV": 10,
91
+ "B-AUX": 13,
92
+ "B-AUX|Polarity=Neg": 16,
93
+ "B-CCONJ": 19,
94
+ "B-DET": 22,
95
+ "B-INTJ": 25,
96
+ "B-NOUN": 28,
97
+ "B-NOUN|Polarity=Neg": 31,
98
+ "B-NUM": 34,
99
+ "B-PART": 37,
100
+ "B-PRON": 40,
101
+ "B-PROPN": 43,
102
+ "B-PUNCT": 46,
103
+ "B-SCONJ": 49,
104
+ "B-SYM": 52,
105
+ "B-VERB": 55,
106
+ "B-X": 58,
107
+ "CCONJ": 18,
108
+ "DET": 21,
109
+ "I-ADJ": 2,
110
+ "I-ADJ|Polarity=Neg": 5,
111
+ "I-ADP": 8,
112
+ "I-ADV": 11,
113
+ "I-AUX": 14,
114
+ "I-AUX|Polarity=Neg": 17,
115
+ "I-CCONJ": 20,
116
+ "I-DET": 23,
117
+ "I-INTJ": 26,
118
+ "I-NOUN": 29,
119
+ "I-NOUN|Polarity=Neg": 32,
120
+ "I-NUM": 35,
121
+ "I-PART": 38,
122
+ "I-PRON": 41,
123
+ "I-PROPN": 44,
124
+ "I-PUNCT": 47,
125
+ "I-SCONJ": 50,
126
+ "I-SYM": 53,
127
+ "I-VERB": 56,
128
+ "I-X": 59,
129
+ "INTJ": 24,
130
+ "NOUN": 27,
131
+ "NOUN|Polarity=Neg": 30,
132
+ "NUM": 33,
133
+ "PART": 36,
134
+ "PRON": 39,
135
+ "PROPN": 42,
136
+ "PUNCT": 45,
137
+ "SCONJ": 48,
138
+ "SYM": 51,
139
+ "VERB": 54,
140
+ "X": 57
141
+ },
142
+ "layer_norm_epsilon": 1e-05,
143
+ "model_type": "gpt2",
144
+ "n_ctx": 1024,
145
+ "n_embd": 2048,
146
+ "n_head": 16,
147
+ "n_inner": 8192,
148
+ "n_layer": 24,
149
+ "n_positions": 2048,
150
+ "reorder_and_upcast_attn": false,
151
+ "resid_pdrop": 0.1,
152
+ "scale_attn_by_inverse_layer_idx": false,
153
+ "scale_attn_weights": true,
154
+ "summary_activation": null,
155
+ "summary_first_dropout": 0.1,
156
+ "summary_proj_to_labels": true,
157
+ "summary_type": "cls_index",
158
+ "summary_use_proj": true,
159
+ "tokenizer_class": "PreTrainedTokenizerFast",
160
+ "torch_dtype": "float32",
161
+ "transformers_version": "4.42.4",
162
+ "use_cache": true,
163
+ "vocab_size": 50688
164
+ }
maker.py ADDED
@@ -0,0 +1,71 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #! /usr/bin/python3
2
+ src="llm-jp/llm-jp-1.3b-v1.0"
3
+ tgt="KoichiYasuoka/llm-jp-1.3b-upos"
4
+
5
+ import os
6
+ from transformers import AutoTokenizer,AutoConfig,GPT2ForTokenClassification,DataCollatorForTokenClassification,TrainingArguments,Trainer
7
+ from tokenizers.normalizers import Replace
8
+ os.system("test -f ja_gsd_modern.conllu || curl -LO https://github.com/KoichiYasuoka/SuPar-UniDic/raw/main/suparunidic/suparmodels/ja_gsd_modern.conllu")
9
+
10
+ class UPOSFileDataset(object):
11
+ def __init__(self,conllu,tokenizer):
12
+ self.conllu=open(conllu,"r",encoding="utf-8")
13
+ self.tokenizer=tokenizer
14
+ self.seeks=[0]
15
+ label=set(["SYM"])
16
+ s=self.conllu.readline()
17
+ while s!="":
18
+ if s=="\n":
19
+ self.seeks.append(self.conllu.tell())
20
+ else:
21
+ w=s.split("\t")
22
+ if len(w)==10:
23
+ if w[0].isdecimal():
24
+ label.add(w[3] if w[5]=="_" else w[3]+"|"+w[5])
25
+ s=self.conllu.readline()
26
+ lid={}
27
+ for i,l in enumerate(sorted(label)):
28
+ lid[l],lid["B-"+l],lid["I-"+l]=i*3,i*3+1,i*3+2
29
+ self.label2id=lid
30
+ def __call__(*args):
31
+ lid={l:i for i,l in enumerate(sorted(set(sum([list(t.label2id) for t in args],[]))))}
32
+ for t in args:
33
+ t.label2id=lid
34
+ return lid
35
+ def __del__(self):
36
+ self.conllu.close()
37
+ __len__=lambda self:len(self.seeks)-1
38
+ def __getitem__(self,i):
39
+ self.conllu.seek(self.seeks[i])
40
+ form,upos,sp=[],[],False
41
+ while self.conllu.tell()<self.seeks[i+1]:
42
+ w=self.conllu.readline().split("\t")
43
+ if len(w)==10:
44
+ form.append(" "+w[1] if sp else w[1])
45
+ if w[0].isdecimal():
46
+ upos.append(w[3] if w[5]=="_" else w[3]+"|"+w[5])
47
+ sp=w[9].find("SpaceAfter=No")<0
48
+ v=self.tokenizer(form,add_special_tokens=False)
49
+ i,u=[],[]
50
+ for j,(x,y) in enumerate(zip(v["input_ids"],upos)):
51
+ if x!=[]:
52
+ i+=x
53
+ u+=[y] if len(x)==1 else ["B-"+y]+["I-"+y]*(len(x)-1)
54
+ if len(i)<self.tokenizer.model_max_length-3:
55
+ ids=i
56
+ upos=u
57
+ else:
58
+ ids=i[0:self.tokenizer.model_max_length-2]
59
+ upos=u[0:self.tokenizer.model_max_length-2]
60
+ return {"input_ids":ids,"labels":[self.label2id[t] for t in upos]}
61
+
62
+ tkz=AutoTokenizer.from_pretrained(src)
63
+ tkz.backend_tokenizer.normalizer=Replace(" ","\u2581")
64
+ trainDS=UPOSFileDataset("ja_gsd_modern.conllu",tkz)
65
+ lid=trainDS.label2id
66
+ cfg=AutoConfig.from_pretrained(src,num_labels=len(lid),label2id=lid,id2label={i:l for l,i in lid.items()},ignore_mismatched_sizes=True)
67
+ arg=TrainingArguments(num_train_epochs=3,per_device_train_batch_size=32,output_dir=tgt,overwrite_output_dir=True,save_total_limit=2,learning_rate=5e-05,warmup_ratio=0.1,save_safetensors=False)
68
+ trn=Trainer(args=arg,data_collator=DataCollatorForTokenClassification(tkz),model=GPT2ForTokenClassification.from_pretrained(src,config=cfg,ignore_mismatched_sizes=True),train_dataset=trainDS)
69
+ trn.train()
70
+ trn.save_model(tgt)
71
+ tkz.save_pretrained(tgt)
pytorch_model-00001-of-00002.bin ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:7a5b5dfec8014e6dfeb371bc52dd5a5db1d25dfad041bdc7d6927b5b79205c3e
3
+ size 4997952446
pytorch_model-00002-of-00002.bin ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:a2386fdce38e5e78c449d901c9845edef1d6f12f4a856e7500196487030014dc
3
+ size 269065006
pytorch_model.bin.index.json ADDED
@@ -0,0 +1,301 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "metadata": {
3
+ "total_size": 5266915568
4
+ },
5
+ "weight_map": {
6
+ "classifier.bias": "pytorch_model-00002-of-00002.bin",
7
+ "classifier.weight": "pytorch_model-00002-of-00002.bin",
8
+ "transformer.h.0.attn.c_attn.bias": "pytorch_model-00001-of-00002.bin",
9
+ "transformer.h.0.attn.c_attn.weight": "pytorch_model-00001-of-00002.bin",
10
+ "transformer.h.0.attn.c_proj.bias": "pytorch_model-00001-of-00002.bin",
11
+ "transformer.h.0.attn.c_proj.weight": "pytorch_model-00001-of-00002.bin",
12
+ "transformer.h.0.ln_1.bias": "pytorch_model-00001-of-00002.bin",
13
+ "transformer.h.0.ln_1.weight": "pytorch_model-00001-of-00002.bin",
14
+ "transformer.h.0.ln_2.bias": "pytorch_model-00001-of-00002.bin",
15
+ "transformer.h.0.ln_2.weight": "pytorch_model-00001-of-00002.bin",
16
+ "transformer.h.0.mlp.c_fc.bias": "pytorch_model-00001-of-00002.bin",
17
+ "transformer.h.0.mlp.c_fc.weight": "pytorch_model-00001-of-00002.bin",
18
+ "transformer.h.0.mlp.c_proj.bias": "pytorch_model-00001-of-00002.bin",
19
+ "transformer.h.0.mlp.c_proj.weight": "pytorch_model-00001-of-00002.bin",
20
+ "transformer.h.1.attn.c_attn.bias": "pytorch_model-00001-of-00002.bin",
21
+ "transformer.h.1.attn.c_attn.weight": "pytorch_model-00001-of-00002.bin",
22
+ "transformer.h.1.attn.c_proj.bias": "pytorch_model-00001-of-00002.bin",
23
+ "transformer.h.1.attn.c_proj.weight": "pytorch_model-00001-of-00002.bin",
24
+ "transformer.h.1.ln_1.bias": "pytorch_model-00001-of-00002.bin",
25
+ "transformer.h.1.ln_1.weight": "pytorch_model-00001-of-00002.bin",
26
+ "transformer.h.1.ln_2.bias": "pytorch_model-00001-of-00002.bin",
27
+ "transformer.h.1.ln_2.weight": "pytorch_model-00001-of-00002.bin",
28
+ "transformer.h.1.mlp.c_fc.bias": "pytorch_model-00001-of-00002.bin",
29
+ "transformer.h.1.mlp.c_fc.weight": "pytorch_model-00001-of-00002.bin",
30
+ "transformer.h.1.mlp.c_proj.bias": "pytorch_model-00001-of-00002.bin",
31
+ "transformer.h.1.mlp.c_proj.weight": "pytorch_model-00001-of-00002.bin",
32
+ "transformer.h.10.attn.c_attn.bias": "pytorch_model-00001-of-00002.bin",
33
+ "transformer.h.10.attn.c_attn.weight": "pytorch_model-00001-of-00002.bin",
34
+ "transformer.h.10.attn.c_proj.bias": "pytorch_model-00001-of-00002.bin",
35
+ "transformer.h.10.attn.c_proj.weight": "pytorch_model-00001-of-00002.bin",
36
+ "transformer.h.10.ln_1.bias": "pytorch_model-00001-of-00002.bin",
37
+ "transformer.h.10.ln_1.weight": "pytorch_model-00001-of-00002.bin",
38
+ "transformer.h.10.ln_2.bias": "pytorch_model-00001-of-00002.bin",
39
+ "transformer.h.10.ln_2.weight": "pytorch_model-00001-of-00002.bin",
40
+ "transformer.h.10.mlp.c_fc.bias": "pytorch_model-00001-of-00002.bin",
41
+ "transformer.h.10.mlp.c_fc.weight": "pytorch_model-00001-of-00002.bin",
42
+ "transformer.h.10.mlp.c_proj.bias": "pytorch_model-00001-of-00002.bin",
43
+ "transformer.h.10.mlp.c_proj.weight": "pytorch_model-00001-of-00002.bin",
44
+ "transformer.h.11.attn.c_attn.bias": "pytorch_model-00001-of-00002.bin",
45
+ "transformer.h.11.attn.c_attn.weight": "pytorch_model-00001-of-00002.bin",
46
+ "transformer.h.11.attn.c_proj.bias": "pytorch_model-00001-of-00002.bin",
47
+ "transformer.h.11.attn.c_proj.weight": "pytorch_model-00001-of-00002.bin",
48
+ "transformer.h.11.ln_1.bias": "pytorch_model-00001-of-00002.bin",
49
+ "transformer.h.11.ln_1.weight": "pytorch_model-00001-of-00002.bin",
50
+ "transformer.h.11.ln_2.bias": "pytorch_model-00001-of-00002.bin",
51
+ "transformer.h.11.ln_2.weight": "pytorch_model-00001-of-00002.bin",
52
+ "transformer.h.11.mlp.c_fc.bias": "pytorch_model-00001-of-00002.bin",
53
+ "transformer.h.11.mlp.c_fc.weight": "pytorch_model-00001-of-00002.bin",
54
+ "transformer.h.11.mlp.c_proj.bias": "pytorch_model-00001-of-00002.bin",
55
+ "transformer.h.11.mlp.c_proj.weight": "pytorch_model-00001-of-00002.bin",
56
+ "transformer.h.12.attn.c_attn.bias": "pytorch_model-00001-of-00002.bin",
57
+ "transformer.h.12.attn.c_attn.weight": "pytorch_model-00001-of-00002.bin",
58
+ "transformer.h.12.attn.c_proj.bias": "pytorch_model-00001-of-00002.bin",
59
+ "transformer.h.12.attn.c_proj.weight": "pytorch_model-00001-of-00002.bin",
60
+ "transformer.h.12.ln_1.bias": "pytorch_model-00001-of-00002.bin",
61
+ "transformer.h.12.ln_1.weight": "pytorch_model-00001-of-00002.bin",
62
+ "transformer.h.12.ln_2.bias": "pytorch_model-00001-of-00002.bin",
63
+ "transformer.h.12.ln_2.weight": "pytorch_model-00001-of-00002.bin",
64
+ "transformer.h.12.mlp.c_fc.bias": "pytorch_model-00001-of-00002.bin",
65
+ "transformer.h.12.mlp.c_fc.weight": "pytorch_model-00001-of-00002.bin",
66
+ "transformer.h.12.mlp.c_proj.bias": "pytorch_model-00001-of-00002.bin",
67
+ "transformer.h.12.mlp.c_proj.weight": "pytorch_model-00001-of-00002.bin",
68
+ "transformer.h.13.attn.c_attn.bias": "pytorch_model-00001-of-00002.bin",
69
+ "transformer.h.13.attn.c_attn.weight": "pytorch_model-00001-of-00002.bin",
70
+ "transformer.h.13.attn.c_proj.bias": "pytorch_model-00001-of-00002.bin",
71
+ "transformer.h.13.attn.c_proj.weight": "pytorch_model-00001-of-00002.bin",
72
+ "transformer.h.13.ln_1.bias": "pytorch_model-00001-of-00002.bin",
73
+ "transformer.h.13.ln_1.weight": "pytorch_model-00001-of-00002.bin",
74
+ "transformer.h.13.ln_2.bias": "pytorch_model-00001-of-00002.bin",
75
+ "transformer.h.13.ln_2.weight": "pytorch_model-00001-of-00002.bin",
76
+ "transformer.h.13.mlp.c_fc.bias": "pytorch_model-00001-of-00002.bin",
77
+ "transformer.h.13.mlp.c_fc.weight": "pytorch_model-00001-of-00002.bin",
78
+ "transformer.h.13.mlp.c_proj.bias": "pytorch_model-00001-of-00002.bin",
79
+ "transformer.h.13.mlp.c_proj.weight": "pytorch_model-00001-of-00002.bin",
80
+ "transformer.h.14.attn.c_attn.bias": "pytorch_model-00001-of-00002.bin",
81
+ "transformer.h.14.attn.c_attn.weight": "pytorch_model-00001-of-00002.bin",
82
+ "transformer.h.14.attn.c_proj.bias": "pytorch_model-00001-of-00002.bin",
83
+ "transformer.h.14.attn.c_proj.weight": "pytorch_model-00001-of-00002.bin",
84
+ "transformer.h.14.ln_1.bias": "pytorch_model-00001-of-00002.bin",
85
+ "transformer.h.14.ln_1.weight": "pytorch_model-00001-of-00002.bin",
86
+ "transformer.h.14.ln_2.bias": "pytorch_model-00001-of-00002.bin",
87
+ "transformer.h.14.ln_2.weight": "pytorch_model-00001-of-00002.bin",
88
+ "transformer.h.14.mlp.c_fc.bias": "pytorch_model-00001-of-00002.bin",
89
+ "transformer.h.14.mlp.c_fc.weight": "pytorch_model-00001-of-00002.bin",
90
+ "transformer.h.14.mlp.c_proj.bias": "pytorch_model-00001-of-00002.bin",
91
+ "transformer.h.14.mlp.c_proj.weight": "pytorch_model-00001-of-00002.bin",
92
+ "transformer.h.15.attn.c_attn.bias": "pytorch_model-00001-of-00002.bin",
93
+ "transformer.h.15.attn.c_attn.weight": "pytorch_model-00001-of-00002.bin",
94
+ "transformer.h.15.attn.c_proj.bias": "pytorch_model-00001-of-00002.bin",
95
+ "transformer.h.15.attn.c_proj.weight": "pytorch_model-00001-of-00002.bin",
96
+ "transformer.h.15.ln_1.bias": "pytorch_model-00001-of-00002.bin",
97
+ "transformer.h.15.ln_1.weight": "pytorch_model-00001-of-00002.bin",
98
+ "transformer.h.15.ln_2.bias": "pytorch_model-00001-of-00002.bin",
99
+ "transformer.h.15.ln_2.weight": "pytorch_model-00001-of-00002.bin",
100
+ "transformer.h.15.mlp.c_fc.bias": "pytorch_model-00001-of-00002.bin",
101
+ "transformer.h.15.mlp.c_fc.weight": "pytorch_model-00001-of-00002.bin",
102
+ "transformer.h.15.mlp.c_proj.bias": "pytorch_model-00001-of-00002.bin",
103
+ "transformer.h.15.mlp.c_proj.weight": "pytorch_model-00001-of-00002.bin",
104
+ "transformer.h.16.attn.c_attn.bias": "pytorch_model-00001-of-00002.bin",
105
+ "transformer.h.16.attn.c_attn.weight": "pytorch_model-00001-of-00002.bin",
106
+ "transformer.h.16.attn.c_proj.bias": "pytorch_model-00001-of-00002.bin",
107
+ "transformer.h.16.attn.c_proj.weight": "pytorch_model-00001-of-00002.bin",
108
+ "transformer.h.16.ln_1.bias": "pytorch_model-00001-of-00002.bin",
109
+ "transformer.h.16.ln_1.weight": "pytorch_model-00001-of-00002.bin",
110
+ "transformer.h.16.ln_2.bias": "pytorch_model-00001-of-00002.bin",
111
+ "transformer.h.16.ln_2.weight": "pytorch_model-00001-of-00002.bin",
112
+ "transformer.h.16.mlp.c_fc.bias": "pytorch_model-00001-of-00002.bin",
113
+ "transformer.h.16.mlp.c_fc.weight": "pytorch_model-00001-of-00002.bin",
114
+ "transformer.h.16.mlp.c_proj.bias": "pytorch_model-00001-of-00002.bin",
115
+ "transformer.h.16.mlp.c_proj.weight": "pytorch_model-00001-of-00002.bin",
116
+ "transformer.h.17.attn.c_attn.bias": "pytorch_model-00001-of-00002.bin",
117
+ "transformer.h.17.attn.c_attn.weight": "pytorch_model-00001-of-00002.bin",
118
+ "transformer.h.17.attn.c_proj.bias": "pytorch_model-00001-of-00002.bin",
119
+ "transformer.h.17.attn.c_proj.weight": "pytorch_model-00001-of-00002.bin",
120
+ "transformer.h.17.ln_1.bias": "pytorch_model-00001-of-00002.bin",
121
+ "transformer.h.17.ln_1.weight": "pytorch_model-00001-of-00002.bin",
122
+ "transformer.h.17.ln_2.bias": "pytorch_model-00001-of-00002.bin",
123
+ "transformer.h.17.ln_2.weight": "pytorch_model-00001-of-00002.bin",
124
+ "transformer.h.17.mlp.c_fc.bias": "pytorch_model-00001-of-00002.bin",
125
+ "transformer.h.17.mlp.c_fc.weight": "pytorch_model-00001-of-00002.bin",
126
+ "transformer.h.17.mlp.c_proj.bias": "pytorch_model-00001-of-00002.bin",
127
+ "transformer.h.17.mlp.c_proj.weight": "pytorch_model-00001-of-00002.bin",
128
+ "transformer.h.18.attn.c_attn.bias": "pytorch_model-00001-of-00002.bin",
129
+ "transformer.h.18.attn.c_attn.weight": "pytorch_model-00001-of-00002.bin",
130
+ "transformer.h.18.attn.c_proj.bias": "pytorch_model-00001-of-00002.bin",
131
+ "transformer.h.18.attn.c_proj.weight": "pytorch_model-00001-of-00002.bin",
132
+ "transformer.h.18.ln_1.bias": "pytorch_model-00001-of-00002.bin",
133
+ "transformer.h.18.ln_1.weight": "pytorch_model-00001-of-00002.bin",
134
+ "transformer.h.18.ln_2.bias": "pytorch_model-00001-of-00002.bin",
135
+ "transformer.h.18.ln_2.weight": "pytorch_model-00001-of-00002.bin",
136
+ "transformer.h.18.mlp.c_fc.bias": "pytorch_model-00001-of-00002.bin",
137
+ "transformer.h.18.mlp.c_fc.weight": "pytorch_model-00001-of-00002.bin",
138
+ "transformer.h.18.mlp.c_proj.bias": "pytorch_model-00001-of-00002.bin",
139
+ "transformer.h.18.mlp.c_proj.weight": "pytorch_model-00001-of-00002.bin",
140
+ "transformer.h.19.attn.c_attn.bias": "pytorch_model-00001-of-00002.bin",
141
+ "transformer.h.19.attn.c_attn.weight": "pytorch_model-00001-of-00002.bin",
142
+ "transformer.h.19.attn.c_proj.bias": "pytorch_model-00001-of-00002.bin",
143
+ "transformer.h.19.attn.c_proj.weight": "pytorch_model-00001-of-00002.bin",
144
+ "transformer.h.19.ln_1.bias": "pytorch_model-00001-of-00002.bin",
145
+ "transformer.h.19.ln_1.weight": "pytorch_model-00001-of-00002.bin",
146
+ "transformer.h.19.ln_2.bias": "pytorch_model-00001-of-00002.bin",
147
+ "transformer.h.19.ln_2.weight": "pytorch_model-00001-of-00002.bin",
148
+ "transformer.h.19.mlp.c_fc.bias": "pytorch_model-00001-of-00002.bin",
149
+ "transformer.h.19.mlp.c_fc.weight": "pytorch_model-00001-of-00002.bin",
150
+ "transformer.h.19.mlp.c_proj.bias": "pytorch_model-00001-of-00002.bin",
151
+ "transformer.h.19.mlp.c_proj.weight": "pytorch_model-00001-of-00002.bin",
152
+ "transformer.h.2.attn.c_attn.bias": "pytorch_model-00001-of-00002.bin",
153
+ "transformer.h.2.attn.c_attn.weight": "pytorch_model-00001-of-00002.bin",
154
+ "transformer.h.2.attn.c_proj.bias": "pytorch_model-00001-of-00002.bin",
155
+ "transformer.h.2.attn.c_proj.weight": "pytorch_model-00001-of-00002.bin",
156
+ "transformer.h.2.ln_1.bias": "pytorch_model-00001-of-00002.bin",
157
+ "transformer.h.2.ln_1.weight": "pytorch_model-00001-of-00002.bin",
158
+ "transformer.h.2.ln_2.bias": "pytorch_model-00001-of-00002.bin",
159
+ "transformer.h.2.ln_2.weight": "pytorch_model-00001-of-00002.bin",
160
+ "transformer.h.2.mlp.c_fc.bias": "pytorch_model-00001-of-00002.bin",
161
+ "transformer.h.2.mlp.c_fc.weight": "pytorch_model-00001-of-00002.bin",
162
+ "transformer.h.2.mlp.c_proj.bias": "pytorch_model-00001-of-00002.bin",
163
+ "transformer.h.2.mlp.c_proj.weight": "pytorch_model-00001-of-00002.bin",
164
+ "transformer.h.20.attn.c_attn.bias": "pytorch_model-00001-of-00002.bin",
165
+ "transformer.h.20.attn.c_attn.weight": "pytorch_model-00001-of-00002.bin",
166
+ "transformer.h.20.attn.c_proj.bias": "pytorch_model-00001-of-00002.bin",
167
+ "transformer.h.20.attn.c_proj.weight": "pytorch_model-00001-of-00002.bin",
168
+ "transformer.h.20.ln_1.bias": "pytorch_model-00001-of-00002.bin",
169
+ "transformer.h.20.ln_1.weight": "pytorch_model-00001-of-00002.bin",
170
+ "transformer.h.20.ln_2.bias": "pytorch_model-00001-of-00002.bin",
171
+ "transformer.h.20.ln_2.weight": "pytorch_model-00001-of-00002.bin",
172
+ "transformer.h.20.mlp.c_fc.bias": "pytorch_model-00001-of-00002.bin",
173
+ "transformer.h.20.mlp.c_fc.weight": "pytorch_model-00001-of-00002.bin",
174
+ "transformer.h.20.mlp.c_proj.bias": "pytorch_model-00001-of-00002.bin",
175
+ "transformer.h.20.mlp.c_proj.weight": "pytorch_model-00001-of-00002.bin",
176
+ "transformer.h.21.attn.c_attn.bias": "pytorch_model-00001-of-00002.bin",
177
+ "transformer.h.21.attn.c_attn.weight": "pytorch_model-00001-of-00002.bin",
178
+ "transformer.h.21.attn.c_proj.bias": "pytorch_model-00001-of-00002.bin",
179
+ "transformer.h.21.attn.c_proj.weight": "pytorch_model-00001-of-00002.bin",
180
+ "transformer.h.21.ln_1.bias": "pytorch_model-00001-of-00002.bin",
181
+ "transformer.h.21.ln_1.weight": "pytorch_model-00001-of-00002.bin",
182
+ "transformer.h.21.ln_2.bias": "pytorch_model-00001-of-00002.bin",
183
+ "transformer.h.21.ln_2.weight": "pytorch_model-00001-of-00002.bin",
184
+ "transformer.h.21.mlp.c_fc.bias": "pytorch_model-00001-of-00002.bin",
185
+ "transformer.h.21.mlp.c_fc.weight": "pytorch_model-00001-of-00002.bin",
186
+ "transformer.h.21.mlp.c_proj.bias": "pytorch_model-00001-of-00002.bin",
187
+ "transformer.h.21.mlp.c_proj.weight": "pytorch_model-00001-of-00002.bin",
188
+ "transformer.h.22.attn.c_attn.bias": "pytorch_model-00001-of-00002.bin",
189
+ "transformer.h.22.attn.c_attn.weight": "pytorch_model-00001-of-00002.bin",
190
+ "transformer.h.22.attn.c_proj.bias": "pytorch_model-00001-of-00002.bin",
191
+ "transformer.h.22.attn.c_proj.weight": "pytorch_model-00001-of-00002.bin",
192
+ "transformer.h.22.ln_1.bias": "pytorch_model-00001-of-00002.bin",
193
+ "transformer.h.22.ln_1.weight": "pytorch_model-00001-of-00002.bin",
194
+ "transformer.h.22.ln_2.bias": "pytorch_model-00001-of-00002.bin",
195
+ "transformer.h.22.ln_2.weight": "pytorch_model-00001-of-00002.bin",
196
+ "transformer.h.22.mlp.c_fc.bias": "pytorch_model-00001-of-00002.bin",
197
+ "transformer.h.22.mlp.c_fc.weight": "pytorch_model-00001-of-00002.bin",
198
+ "transformer.h.22.mlp.c_proj.bias": "pytorch_model-00002-of-00002.bin",
199
+ "transformer.h.22.mlp.c_proj.weight": "pytorch_model-00002-of-00002.bin",
200
+ "transformer.h.23.attn.c_attn.bias": "pytorch_model-00002-of-00002.bin",
201
+ "transformer.h.23.attn.c_attn.weight": "pytorch_model-00002-of-00002.bin",
202
+ "transformer.h.23.attn.c_proj.bias": "pytorch_model-00002-of-00002.bin",
203
+ "transformer.h.23.attn.c_proj.weight": "pytorch_model-00002-of-00002.bin",
204
+ "transformer.h.23.ln_1.bias": "pytorch_model-00002-of-00002.bin",
205
+ "transformer.h.23.ln_1.weight": "pytorch_model-00002-of-00002.bin",
206
+ "transformer.h.23.ln_2.bias": "pytorch_model-00002-of-00002.bin",
207
+ "transformer.h.23.ln_2.weight": "pytorch_model-00002-of-00002.bin",
208
+ "transformer.h.23.mlp.c_fc.bias": "pytorch_model-00002-of-00002.bin",
209
+ "transformer.h.23.mlp.c_fc.weight": "pytorch_model-00002-of-00002.bin",
210
+ "transformer.h.23.mlp.c_proj.bias": "pytorch_model-00002-of-00002.bin",
211
+ "transformer.h.23.mlp.c_proj.weight": "pytorch_model-00002-of-00002.bin",
212
+ "transformer.h.3.attn.c_attn.bias": "pytorch_model-00001-of-00002.bin",
213
+ "transformer.h.3.attn.c_attn.weight": "pytorch_model-00001-of-00002.bin",
214
+ "transformer.h.3.attn.c_proj.bias": "pytorch_model-00001-of-00002.bin",
215
+ "transformer.h.3.attn.c_proj.weight": "pytorch_model-00001-of-00002.bin",
216
+ "transformer.h.3.ln_1.bias": "pytorch_model-00001-of-00002.bin",
217
+ "transformer.h.3.ln_1.weight": "pytorch_model-00001-of-00002.bin",
218
+ "transformer.h.3.ln_2.bias": "pytorch_model-00001-of-00002.bin",
219
+ "transformer.h.3.ln_2.weight": "pytorch_model-00001-of-00002.bin",
220
+ "transformer.h.3.mlp.c_fc.bias": "pytorch_model-00001-of-00002.bin",
221
+ "transformer.h.3.mlp.c_fc.weight": "pytorch_model-00001-of-00002.bin",
222
+ "transformer.h.3.mlp.c_proj.bias": "pytorch_model-00001-of-00002.bin",
223
+ "transformer.h.3.mlp.c_proj.weight": "pytorch_model-00001-of-00002.bin",
224
+ "transformer.h.4.attn.c_attn.bias": "pytorch_model-00001-of-00002.bin",
225
+ "transformer.h.4.attn.c_attn.weight": "pytorch_model-00001-of-00002.bin",
226
+ "transformer.h.4.attn.c_proj.bias": "pytorch_model-00001-of-00002.bin",
227
+ "transformer.h.4.attn.c_proj.weight": "pytorch_model-00001-of-00002.bin",
228
+ "transformer.h.4.ln_1.bias": "pytorch_model-00001-of-00002.bin",
229
+ "transformer.h.4.ln_1.weight": "pytorch_model-00001-of-00002.bin",
230
+ "transformer.h.4.ln_2.bias": "pytorch_model-00001-of-00002.bin",
231
+ "transformer.h.4.ln_2.weight": "pytorch_model-00001-of-00002.bin",
232
+ "transformer.h.4.mlp.c_fc.bias": "pytorch_model-00001-of-00002.bin",
233
+ "transformer.h.4.mlp.c_fc.weight": "pytorch_model-00001-of-00002.bin",
234
+ "transformer.h.4.mlp.c_proj.bias": "pytorch_model-00001-of-00002.bin",
235
+ "transformer.h.4.mlp.c_proj.weight": "pytorch_model-00001-of-00002.bin",
236
+ "transformer.h.5.attn.c_attn.bias": "pytorch_model-00001-of-00002.bin",
237
+ "transformer.h.5.attn.c_attn.weight": "pytorch_model-00001-of-00002.bin",
238
+ "transformer.h.5.attn.c_proj.bias": "pytorch_model-00001-of-00002.bin",
239
+ "transformer.h.5.attn.c_proj.weight": "pytorch_model-00001-of-00002.bin",
240
+ "transformer.h.5.ln_1.bias": "pytorch_model-00001-of-00002.bin",
241
+ "transformer.h.5.ln_1.weight": "pytorch_model-00001-of-00002.bin",
242
+ "transformer.h.5.ln_2.bias": "pytorch_model-00001-of-00002.bin",
243
+ "transformer.h.5.ln_2.weight": "pytorch_model-00001-of-00002.bin",
244
+ "transformer.h.5.mlp.c_fc.bias": "pytorch_model-00001-of-00002.bin",
245
+ "transformer.h.5.mlp.c_fc.weight": "pytorch_model-00001-of-00002.bin",
246
+ "transformer.h.5.mlp.c_proj.bias": "pytorch_model-00001-of-00002.bin",
247
+ "transformer.h.5.mlp.c_proj.weight": "pytorch_model-00001-of-00002.bin",
248
+ "transformer.h.6.attn.c_attn.bias": "pytorch_model-00001-of-00002.bin",
249
+ "transformer.h.6.attn.c_attn.weight": "pytorch_model-00001-of-00002.bin",
250
+ "transformer.h.6.attn.c_proj.bias": "pytorch_model-00001-of-00002.bin",
251
+ "transformer.h.6.attn.c_proj.weight": "pytorch_model-00001-of-00002.bin",
252
+ "transformer.h.6.ln_1.bias": "pytorch_model-00001-of-00002.bin",
253
+ "transformer.h.6.ln_1.weight": "pytorch_model-00001-of-00002.bin",
254
+ "transformer.h.6.ln_2.bias": "pytorch_model-00001-of-00002.bin",
255
+ "transformer.h.6.ln_2.weight": "pytorch_model-00001-of-00002.bin",
256
+ "transformer.h.6.mlp.c_fc.bias": "pytorch_model-00001-of-00002.bin",
257
+ "transformer.h.6.mlp.c_fc.weight": "pytorch_model-00001-of-00002.bin",
258
+ "transformer.h.6.mlp.c_proj.bias": "pytorch_model-00001-of-00002.bin",
259
+ "transformer.h.6.mlp.c_proj.weight": "pytorch_model-00001-of-00002.bin",
260
+ "transformer.h.7.attn.c_attn.bias": "pytorch_model-00001-of-00002.bin",
261
+ "transformer.h.7.attn.c_attn.weight": "pytorch_model-00001-of-00002.bin",
262
+ "transformer.h.7.attn.c_proj.bias": "pytorch_model-00001-of-00002.bin",
263
+ "transformer.h.7.attn.c_proj.weight": "pytorch_model-00001-of-00002.bin",
264
+ "transformer.h.7.ln_1.bias": "pytorch_model-00001-of-00002.bin",
265
+ "transformer.h.7.ln_1.weight": "pytorch_model-00001-of-00002.bin",
266
+ "transformer.h.7.ln_2.bias": "pytorch_model-00001-of-00002.bin",
267
+ "transformer.h.7.ln_2.weight": "pytorch_model-00001-of-00002.bin",
268
+ "transformer.h.7.mlp.c_fc.bias": "pytorch_model-00001-of-00002.bin",
269
+ "transformer.h.7.mlp.c_fc.weight": "pytorch_model-00001-of-00002.bin",
270
+ "transformer.h.7.mlp.c_proj.bias": "pytorch_model-00001-of-00002.bin",
271
+ "transformer.h.7.mlp.c_proj.weight": "pytorch_model-00001-of-00002.bin",
272
+ "transformer.h.8.attn.c_attn.bias": "pytorch_model-00001-of-00002.bin",
273
+ "transformer.h.8.attn.c_attn.weight": "pytorch_model-00001-of-00002.bin",
274
+ "transformer.h.8.attn.c_proj.bias": "pytorch_model-00001-of-00002.bin",
275
+ "transformer.h.8.attn.c_proj.weight": "pytorch_model-00001-of-00002.bin",
276
+ "transformer.h.8.ln_1.bias": "pytorch_model-00001-of-00002.bin",
277
+ "transformer.h.8.ln_1.weight": "pytorch_model-00001-of-00002.bin",
278
+ "transformer.h.8.ln_2.bias": "pytorch_model-00001-of-00002.bin",
279
+ "transformer.h.8.ln_2.weight": "pytorch_model-00001-of-00002.bin",
280
+ "transformer.h.8.mlp.c_fc.bias": "pytorch_model-00001-of-00002.bin",
281
+ "transformer.h.8.mlp.c_fc.weight": "pytorch_model-00001-of-00002.bin",
282
+ "transformer.h.8.mlp.c_proj.bias": "pytorch_model-00001-of-00002.bin",
283
+ "transformer.h.8.mlp.c_proj.weight": "pytorch_model-00001-of-00002.bin",
284
+ "transformer.h.9.attn.c_attn.bias": "pytorch_model-00001-of-00002.bin",
285
+ "transformer.h.9.attn.c_attn.weight": "pytorch_model-00001-of-00002.bin",
286
+ "transformer.h.9.attn.c_proj.bias": "pytorch_model-00001-of-00002.bin",
287
+ "transformer.h.9.attn.c_proj.weight": "pytorch_model-00001-of-00002.bin",
288
+ "transformer.h.9.ln_1.bias": "pytorch_model-00001-of-00002.bin",
289
+ "transformer.h.9.ln_1.weight": "pytorch_model-00001-of-00002.bin",
290
+ "transformer.h.9.ln_2.bias": "pytorch_model-00001-of-00002.bin",
291
+ "transformer.h.9.ln_2.weight": "pytorch_model-00001-of-00002.bin",
292
+ "transformer.h.9.mlp.c_fc.bias": "pytorch_model-00001-of-00002.bin",
293
+ "transformer.h.9.mlp.c_fc.weight": "pytorch_model-00001-of-00002.bin",
294
+ "transformer.h.9.mlp.c_proj.bias": "pytorch_model-00001-of-00002.bin",
295
+ "transformer.h.9.mlp.c_proj.weight": "pytorch_model-00001-of-00002.bin",
296
+ "transformer.ln_f.bias": "pytorch_model-00002-of-00002.bin",
297
+ "transformer.ln_f.weight": "pytorch_model-00002-of-00002.bin",
298
+ "transformer.wpe.weight": "pytorch_model-00001-of-00002.bin",
299
+ "transformer.wte.weight": "pytorch_model-00001-of-00002.bin"
300
+ }
301
+ }
special_tokens_map.json ADDED
@@ -0,0 +1,54 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "additional_special_tokens": [
3
+ "</s|LLM-jp>"
4
+ ],
5
+ "bos_token": {
6
+ "content": "<s|LLM-jp>",
7
+ "lstrip": false,
8
+ "normalized": false,
9
+ "rstrip": false,
10
+ "single_word": false
11
+ },
12
+ "cls_token": {
13
+ "content": "<CLS|LLM-jp>",
14
+ "lstrip": false,
15
+ "normalized": false,
16
+ "rstrip": false,
17
+ "single_word": false
18
+ },
19
+ "eos_token": {
20
+ "content": "<EOD|LLM-jp>",
21
+ "lstrip": false,
22
+ "normalized": false,
23
+ "rstrip": false,
24
+ "single_word": false
25
+ },
26
+ "mask_token": {
27
+ "content": "<mask|LLM-jp>",
28
+ "lstrip": false,
29
+ "normalized": false,
30
+ "rstrip": false,
31
+ "single_word": false
32
+ },
33
+ "pad_token": {
34
+ "content": "<pad|LLM-jp>",
35
+ "lstrip": false,
36
+ "normalized": false,
37
+ "rstrip": false,
38
+ "single_word": false
39
+ },
40
+ "sep_token": {
41
+ "content": "<SEP|LLM-jp>",
42
+ "lstrip": false,
43
+ "normalized": false,
44
+ "rstrip": false,
45
+ "single_word": false
46
+ },
47
+ "unk_token": {
48
+ "content": "<unk|LLM-jp>",
49
+ "lstrip": false,
50
+ "normalized": false,
51
+ "rstrip": false,
52
+ "single_word": false
53
+ }
54
+ }
tokenizer.json ADDED
The diff for this file is too large to render. See raw diff
 
tokenizer_config.json ADDED
@@ -0,0 +1,84 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "added_tokens_decoder": {
3
+ "0": {
4
+ "content": "<unk|LLM-jp>",
5
+ "lstrip": false,
6
+ "normalized": false,
7
+ "rstrip": false,
8
+ "single_word": false,
9
+ "special": true
10
+ },
11
+ "1": {
12
+ "content": "<s|LLM-jp>",
13
+ "lstrip": false,
14
+ "normalized": false,
15
+ "rstrip": false,
16
+ "single_word": false,
17
+ "special": true
18
+ },
19
+ "2": {
20
+ "content": "</s|LLM-jp>",
21
+ "lstrip": false,
22
+ "normalized": false,
23
+ "rstrip": false,
24
+ "single_word": false,
25
+ "special": true
26
+ },
27
+ "3": {
28
+ "content": "<mask|LLM-jp>",
29
+ "lstrip": false,
30
+ "normalized": false,
31
+ "rstrip": false,
32
+ "single_word": false,
33
+ "special": true
34
+ },
35
+ "4": {
36
+ "content": "<pad|LLM-jp>",
37
+ "lstrip": false,
38
+ "normalized": false,
39
+ "rstrip": false,
40
+ "single_word": false,
41
+ "special": true
42
+ },
43
+ "5": {
44
+ "content": "<CLS|LLM-jp>",
45
+ "lstrip": false,
46
+ "normalized": false,
47
+ "rstrip": false,
48
+ "single_word": false,
49
+ "special": true
50
+ },
51
+ "6": {
52
+ "content": "<SEP|LLM-jp>",
53
+ "lstrip": false,
54
+ "normalized": false,
55
+ "rstrip": false,
56
+ "single_word": false,
57
+ "special": true
58
+ },
59
+ "7": {
60
+ "content": "<EOD|LLM-jp>",
61
+ "lstrip": false,
62
+ "normalized": false,
63
+ "rstrip": false,
64
+ "single_word": false,
65
+ "special": true
66
+ }
67
+ },
68
+ "additional_special_tokens": [
69
+ "</s|LLM-jp>"
70
+ ],
71
+ "bos_token": "<s|LLM-jp>",
72
+ "clean_up_tokenization_spaces": false,
73
+ "cls_token": "<CLS|LLM-jp>",
74
+ "eod_token": "<EOD|LLM-jp>",
75
+ "eos_token": "<EOD|LLM-jp>",
76
+ "extra_ids": 0,
77
+ "mask_token": "<mask|LLM-jp>",
78
+ "model_max_length": 1000000000000000019884624838656,
79
+ "pad_token": "<pad|LLM-jp>",
80
+ "sep_token": "<SEP|LLM-jp>",
81
+ "sp_model_kwargs": {},
82
+ "tokenizer_class": "PreTrainedTokenizerFast",
83
+ "unk_token": "<unk|LLM-jp>"
84
+ }
upos.py ADDED
@@ -0,0 +1,41 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from transformers import TokenClassificationPipeline
2
+
3
+ class BellmanFordTokenClassificationPipeline(TokenClassificationPipeline):
4
+ def __init__(self,**kwargs):
5
+ import numpy
6
+ super().__init__(**kwargs)
7
+ x=self.model.config.label2id
8
+ y=[k for k in x if not k.startswith("I-")]
9
+ self.transition=numpy.full((len(x),len(x)),numpy.nan)
10
+ for k,v in x.items():
11
+ for j in ["I-"+k[2:]] if k.startswith("B-") else [k]+y if k.startswith("I-") else y:
12
+ self.transition[v,x[j]]=0
13
+ def check_model_type(self,supported_models):
14
+ pass
15
+ def postprocess(self,model_outputs,**kwargs):
16
+ import numpy
17
+ if "logits" not in model_outputs:
18
+ return self.postprocess(model_outputs[0],**kwargs)
19
+ m=model_outputs["logits"][0].numpy()
20
+ e=numpy.exp(m-numpy.max(m,axis=-1,keepdims=True))
21
+ z=e/e.sum(axis=-1,keepdims=True)
22
+ for i in range(m.shape[0]-1,0,-1):
23
+ m[i-1]+=numpy.nanmax(m[i]+self.transition,axis=1)
24
+ k=[numpy.nanargmax(m[0]+self.transition[0])]
25
+ for i in range(1,m.shape[0]):
26
+ k.append(numpy.nanargmax(m[i]+self.transition[k[-1]]))
27
+ 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]
28
+ if "aggregation_strategy" in kwargs and kwargs["aggregation_strategy"]!="none":
29
+ for i,t in reversed(list(enumerate(w))):
30
+ p=t.pop("entity")
31
+ if p.startswith("I-"):
32
+ w[i-1]["score"]=min(w[i-1]["score"],t["score"])
33
+ w[i-1]["end"]=w.pop(i)["end"]
34
+ elif p.startswith("B-"):
35
+ t["entity_group"]=p[2:]
36
+ else:
37
+ t["entity_group"]=p
38
+ for t in w:
39
+ t["text"]=model_outputs["sentence"][t["start"]:t["end"]]
40
+ return w
41
+