KoichiYasuoka
commited on
Commit
·
cf5f74d
1
Parent(s):
437962c
initial release
Browse files- README.md +54 -3
- config.json +131 -0
- pytorch_model.bin +3 -0
- special_tokens_map.json +1 -0
- supar.model +3 -0
- tokenizer_config.json +1 -0
- vocab.txt +0 -0
README.md
CHANGED
@@ -1,3 +1,54 @@
|
|
1 |
-
---
|
2 |
-
|
3 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
language:
|
3 |
+
- "ja"
|
4 |
+
tags:
|
5 |
+
- "japanese"
|
6 |
+
- "token-classification"
|
7 |
+
- "pos"
|
8 |
+
- "wikipedia"
|
9 |
+
- "dependency-parsing"
|
10 |
+
datasets:
|
11 |
+
- "universal_dependencies"
|
12 |
+
license: "cc-by-sa-4.0"
|
13 |
+
pipeline_tag: "token-classification"
|
14 |
+
widget:
|
15 |
+
- text: "国境の長いトンネルを抜けると雪国であった。"
|
16 |
+
---
|
17 |
+
|
18 |
+
# bert-large-japanese-unidic-luw-upos
|
19 |
+
|
20 |
+
## Model Description
|
21 |
+
|
22 |
+
This is a BERT model pre-trained on Japanese Wikipedia texts for POS-tagging and dependency-parsing, derived from [bert-large-japanese](https://huggingface.co/cl-tohoku/bert-large-japanese). Every long-unit-word is tagged by [UPOS](https://universaldependencies.org/u/pos/) (Universal Part-Of-Speech).
|
23 |
+
|
24 |
+
## How to Use
|
25 |
+
|
26 |
+
```py
|
27 |
+
import torch
|
28 |
+
from transformers import AutoTokenizer,AutoModelForTokenClassification
|
29 |
+
tokenizer=AutoTokenizer.from_pretrained("KoichiYasuoka/bert-large-japanese-unidic-luw-upos")
|
30 |
+
model=AutoModelForTokenClassification.from_pretrained("KoichiYasuoka/bert-large-japanese-unidic-luw-upos")
|
31 |
+
s="国境の長いトンネルを抜けると雪国であった。"
|
32 |
+
t=tokenizer.tokenize(s)
|
33 |
+
p=[model.config.id2label[q] for q in torch.argmax(model(tokenizer.encode(s,return_tensors="pt"))["logits"],dim=2)[0].tolist()[1:-1]]
|
34 |
+
print(list(zip(t,p)))
|
35 |
+
```
|
36 |
+
|
37 |
+
or
|
38 |
+
|
39 |
+
```py
|
40 |
+
import esupar
|
41 |
+
nlp=esupar.load("KoichiYasuoka/bert-large-japanese-unidic-luw-upos")
|
42 |
+
print(nlp("国境の長いトンネルを抜けると雪国であった。"))
|
43 |
+
```
|
44 |
+
|
45 |
+
[fugashi](https://pypi.org/project/fugashi), [unidic-lite](https://pypi.org/project/unidic-lite) and [pytokenizations](https://pypi.org/project/pytokenizations) are required.
|
46 |
+
|
47 |
+
## Reference
|
48 |
+
|
49 |
+
安岡孝一: [Transformersと国語研長単位による日本語係り受け解析モデルの製作](http://id.nii.ac.jp/1001/00216223/), 情報処理学会研究報告, Vol.2022-CH-128, No.7 (2022年2月), pp.1-8.
|
50 |
+
|
51 |
+
## See Also
|
52 |
+
|
53 |
+
[esupar](https://github.com/KoichiYasuoka/esupar): Tokenizer POS-tagger and Dependency-parser with BERT/RoBERTa models
|
54 |
+
|
config.json
ADDED
@@ -0,0 +1,131 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"architectures": [
|
3 |
+
"BertForTokenClassification"
|
4 |
+
],
|
5 |
+
"attention_probs_dropout_prob": 0.1,
|
6 |
+
"classifier_dropout": null,
|
7 |
+
"hidden_act": "gelu",
|
8 |
+
"hidden_dropout_prob": 0.1,
|
9 |
+
"hidden_size": 1024,
|
10 |
+
"id2label": {
|
11 |
+
"0": "B-SYM",
|
12 |
+
"1": "B-INTJ",
|
13 |
+
"2": "I-ADP",
|
14 |
+
"3": "I-X",
|
15 |
+
"4": "ADP",
|
16 |
+
"5": "PUNCT",
|
17 |
+
"6": "B-VERB",
|
18 |
+
"7": "I-VERB",
|
19 |
+
"8": "I-NUM",
|
20 |
+
"9": "VERB",
|
21 |
+
"10": "PRON",
|
22 |
+
"11": "I-DET",
|
23 |
+
"12": "B-ADP",
|
24 |
+
"13": "PROPN",
|
25 |
+
"14": "I-PUNCT",
|
26 |
+
"15": "I-CCONJ",
|
27 |
+
"16": "NUM",
|
28 |
+
"17": "I-INTJ",
|
29 |
+
"18": "AUX",
|
30 |
+
"19": "INTJ",
|
31 |
+
"20": "CCONJ",
|
32 |
+
"21": "I-PRON",
|
33 |
+
"22": "B-CCONJ",
|
34 |
+
"23": "X",
|
35 |
+
"24": "B-PUNCT",
|
36 |
+
"25": "I-SYM",
|
37 |
+
"26": "I-SCONJ",
|
38 |
+
"27": "SCONJ",
|
39 |
+
"28": "NOUN",
|
40 |
+
"29": "DET",
|
41 |
+
"30": "ADV",
|
42 |
+
"31": "PART",
|
43 |
+
"32": "B-PRON",
|
44 |
+
"33": "I-AUX",
|
45 |
+
"34": "B-NUM",
|
46 |
+
"35": "I-ADJ",
|
47 |
+
"36": "B-SCONJ",
|
48 |
+
"37": "I-PART",
|
49 |
+
"38": "I-NOUN",
|
50 |
+
"39": "I-ADV",
|
51 |
+
"40": "ADJ",
|
52 |
+
"41": "B-X",
|
53 |
+
"42": "B-AUX",
|
54 |
+
"43": "B-PROPN",
|
55 |
+
"44": "B-DET",
|
56 |
+
"45": "B-ADV",
|
57 |
+
"46": "I-PROPN",
|
58 |
+
"47": "B-NOUN",
|
59 |
+
"48": "SYM",
|
60 |
+
"49": "B-PART",
|
61 |
+
"50": "B-ADJ"
|
62 |
+
},
|
63 |
+
"initializer_range": 0.02,
|
64 |
+
"intermediate_size": 4096,
|
65 |
+
"label2id": {
|
66 |
+
"ADJ": 40,
|
67 |
+
"ADP": 4,
|
68 |
+
"ADV": 30,
|
69 |
+
"AUX": 18,
|
70 |
+
"B-ADJ": 50,
|
71 |
+
"B-ADP": 12,
|
72 |
+
"B-ADV": 45,
|
73 |
+
"B-AUX": 42,
|
74 |
+
"B-CCONJ": 22,
|
75 |
+
"B-DET": 44,
|
76 |
+
"B-INTJ": 1,
|
77 |
+
"B-NOUN": 47,
|
78 |
+
"B-NUM": 34,
|
79 |
+
"B-PART": 49,
|
80 |
+
"B-PRON": 32,
|
81 |
+
"B-PROPN": 43,
|
82 |
+
"B-PUNCT": 24,
|
83 |
+
"B-SCONJ": 36,
|
84 |
+
"B-SYM": 0,
|
85 |
+
"B-VERB": 6,
|
86 |
+
"B-X": 41,
|
87 |
+
"CCONJ": 20,
|
88 |
+
"DET": 29,
|
89 |
+
"I-ADJ": 35,
|
90 |
+
"I-ADP": 2,
|
91 |
+
"I-ADV": 39,
|
92 |
+
"I-AUX": 33,
|
93 |
+
"I-CCONJ": 15,
|
94 |
+
"I-DET": 11,
|
95 |
+
"I-INTJ": 17,
|
96 |
+
"I-NOUN": 38,
|
97 |
+
"I-NUM": 8,
|
98 |
+
"I-PART": 37,
|
99 |
+
"I-PRON": 21,
|
100 |
+
"I-PROPN": 46,
|
101 |
+
"I-PUNCT": 14,
|
102 |
+
"I-SCONJ": 26,
|
103 |
+
"I-SYM": 25,
|
104 |
+
"I-VERB": 7,
|
105 |
+
"I-X": 3,
|
106 |
+
"INTJ": 19,
|
107 |
+
"NOUN": 28,
|
108 |
+
"NUM": 16,
|
109 |
+
"PART": 31,
|
110 |
+
"PRON": 10,
|
111 |
+
"PROPN": 13,
|
112 |
+
"PUNCT": 5,
|
113 |
+
"SCONJ": 27,
|
114 |
+
"SYM": 48,
|
115 |
+
"VERB": 9,
|
116 |
+
"X": 23
|
117 |
+
},
|
118 |
+
"layer_norm_eps": 1e-12,
|
119 |
+
"max_position_embeddings": 512,
|
120 |
+
"model_type": "bert",
|
121 |
+
"num_attention_heads": 16,
|
122 |
+
"num_hidden_layers": 24,
|
123 |
+
"pad_token_id": 0,
|
124 |
+
"position_embedding_type": "absolute",
|
125 |
+
"tokenizer_class": "BertJapaneseTokenizer",
|
126 |
+
"torch_dtype": "float32",
|
127 |
+
"transformers_version": "4.11.3",
|
128 |
+
"type_vocab_size": 2,
|
129 |
+
"use_cache": true,
|
130 |
+
"vocab_size": 32768
|
131 |
+
}
|
pytorch_model.bin
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:c26b02e8926191ac7f7fb3340d3d286e08fe213b8b34a0dafe120ad0b2f00bec
|
3 |
+
size 1345944210
|
special_tokens_map.json
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
{"unk_token": "[UNK]", "sep_token": "[SEP]", "pad_token": "[PAD]", "cls_token": "[CLS]", "mask_token": "[MASK]"}
|
supar.model
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:b2e1383c4cbb6c4a5f2a2a09cb8a89e726415291e030194772840dbcc68f68d9
|
3 |
+
size 1399761610
|
tokenizer_config.json
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
{"unk_token": "[UNK]", "sep_token": "[SEP]", "pad_token": "[PAD]", "cls_token": "[CLS]", "mask_token": "[MASK]", "do_lower_case": false, "do_word_tokenize": true, "do_subword_tokenize": true, "word_tokenizer_type": "mecab", "subword_tokenizer_type": "wordpiece", "never_split": null, "mecab_kwargs": {"mecab_dic": "unidic_lite"}, "model_max_length": 512, "tokenizer_class": "BertJapaneseTokenizer"}
|
vocab.txt
ADDED
The diff for this file is too large to render.
See raw diff
|
|