KoichiYasuoka commited on
Commit
6514e69
1 Parent(s): cdc358d

initial release

Browse files
Files changed (7) hide show
  1. README.md +53 -3
  2. config.json +131 -0
  3. pytorch_model.bin +3 -0
  4. special_tokens_map.json +1 -0
  5. supar.model +3 -0
  6. tokenizer_config.json +1 -0
  7. vocab.txt +0 -0
README.md CHANGED
@@ -1,3 +1,53 @@
1
- ---
2
- license: cc-by-sa-4.0
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-base-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-base-japanese-v2](https://huggingface.co/cl-tohoku/bert-base-japanese-v2). 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-base-japanese-unidic-luw-upos")
30
+ model=AutoModelForTokenClassification.from_pretrained("KoichiYasuoka/bert-base-japanese-unidic-luw-upos")
31
+ s="国境の長いトンネルを抜けると雪国であった。"
32
+ p=[model.config.id2label[q] for q in torch.argmax(model(tokenizer.encode(s,return_tensors="pt"))["logits"],dim=2)[0].tolist()[1:-1]]
33
+ print(list(zip(s,p)))
34
+ ```
35
+
36
+ or
37
+
38
+ ```py
39
+ import esupar
40
+ nlp=esupar.load("KoichiYasuoka/bert-base-japanese-unidic-luw-upos")
41
+ print(nlp("国境の長いトンネルを抜けると雪国であった。"))
42
+ ```
43
+
44
+ [fugashi](https://pypi.org/project/fugashi) [unidic-lite](https://pypi.org/project/unidic-lite) [pytokenizations](https://pypi.org/project/pytokenizations) are required.
45
+
46
+ ## Reference
47
+
48
+ 安岡孝一: [Transformersと国語研長単位による日本語係り受け解析モデルの製作](http://id.nii.ac.jp/1001/00216223/), 情報処理学会研究報告, Vol.2022-CH-128, No.7 (2022年2月), pp.1-8.
49
+
50
+ ## See Also
51
+
52
+ [esupar](https://github.com/KoichiYasuoka/esupar): Tokenizer POS-tagger and Dependency-parser with BERT/RoBERTa models
53
+
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": 768,
10
+ "id2label": {
11
+ "0": "ADP",
12
+ "1": "B-NUM",
13
+ "2": "B-ADV",
14
+ "3": "I-ADJ",
15
+ "4": "NOUN",
16
+ "5": "ADV",
17
+ "6": "B-SYM",
18
+ "7": "PRON",
19
+ "8": "B-ADJ",
20
+ "9": "B-NOUN",
21
+ "10": "B-VERB",
22
+ "11": "I-VERB",
23
+ "12": "I-DET",
24
+ "13": "B-PRON",
25
+ "14": "B-X",
26
+ "15": "B-ADP",
27
+ "16": "VERB",
28
+ "17": "X",
29
+ "18": "B-AUX",
30
+ "19": "PART",
31
+ "20": "I-PROPN",
32
+ "21": "B-PROPN",
33
+ "22": "ADJ",
34
+ "23": "I-CCONJ",
35
+ "24": "I-AUX",
36
+ "25": "I-NUM",
37
+ "26": "INTJ",
38
+ "27": "SCONJ",
39
+ "28": "I-ADP",
40
+ "29": "I-SCONJ",
41
+ "30": "B-DET",
42
+ "31": "B-CCONJ",
43
+ "32": "NUM",
44
+ "33": "PUNCT",
45
+ "34": "I-ADV",
46
+ "35": "I-PUNCT",
47
+ "36": "I-X",
48
+ "37": "I-PART",
49
+ "38": "CCONJ",
50
+ "39": "B-SCONJ",
51
+ "40": "I-PRON",
52
+ "41": "DET",
53
+ "42": "I-NOUN",
54
+ "43": "I-SYM",
55
+ "44": "SYM",
56
+ "45": "B-INTJ",
57
+ "46": "B-PART",
58
+ "47": "B-PUNCT",
59
+ "48": "PROPN",
60
+ "49": "I-INTJ",
61
+ "50": "AUX"
62
+ },
63
+ "initializer_range": 0.02,
64
+ "intermediate_size": 3072,
65
+ "label2id": {
66
+ "ADJ": 22,
67
+ "ADP": 0,
68
+ "ADV": 5,
69
+ "AUX": 50,
70
+ "B-ADJ": 8,
71
+ "B-ADP": 15,
72
+ "B-ADV": 2,
73
+ "B-AUX": 18,
74
+ "B-CCONJ": 31,
75
+ "B-DET": 30,
76
+ "B-INTJ": 45,
77
+ "B-NOUN": 9,
78
+ "B-NUM": 1,
79
+ "B-PART": 46,
80
+ "B-PRON": 13,
81
+ "B-PROPN": 21,
82
+ "B-PUNCT": 47,
83
+ "B-SCONJ": 39,
84
+ "B-SYM": 6,
85
+ "B-VERB": 10,
86
+ "B-X": 14,
87
+ "CCONJ": 38,
88
+ "DET": 41,
89
+ "I-ADJ": 3,
90
+ "I-ADP": 28,
91
+ "I-ADV": 34,
92
+ "I-AUX": 24,
93
+ "I-CCONJ": 23,
94
+ "I-DET": 12,
95
+ "I-INTJ": 49,
96
+ "I-NOUN": 42,
97
+ "I-NUM": 25,
98
+ "I-PART": 37,
99
+ "I-PRON": 40,
100
+ "I-PROPN": 20,
101
+ "I-PUNCT": 35,
102
+ "I-SCONJ": 29,
103
+ "I-SYM": 43,
104
+ "I-VERB": 11,
105
+ "I-X": 36,
106
+ "INTJ": 26,
107
+ "NOUN": 4,
108
+ "NUM": 32,
109
+ "PART": 19,
110
+ "PRON": 7,
111
+ "PROPN": 48,
112
+ "PUNCT": 33,
113
+ "SCONJ": 27,
114
+ "SYM": 44,
115
+ "VERB": 16,
116
+ "X": 17
117
+ },
118
+ "layer_norm_eps": 1e-12,
119
+ "max_position_embeddings": 512,
120
+ "model_type": "bert",
121
+ "num_attention_heads": 12,
122
+ "num_hidden_layers": 12,
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:180487d386249133176cd2a8ff76c66ecd0da56c08054e772b049dfc07a62aef
3
+ size 442709778
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:a3615f3b3d3e13252c624522d85752ba90a43fbe8e4c8d27acac9474f6ab8438
3
+ size 494654056
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