KoichiYasuoka commited on
Commit
92e768f
1 Parent(s): 40ef92d

initial release

Browse files
Files changed (6) hide show
  1. README.md +32 -0
  2. config.json +117 -0
  3. pytorch_model.bin +3 -0
  4. special_tokens_map.json +1 -0
  5. tokenizer_config.json +1 -0
  6. vocab.txt +6291 -0
README.md ADDED
@@ -0,0 +1,32 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ language:
3
+ - "ja"
4
+ tags:
5
+ - "japanese"
6
+ - "token-classification"
7
+ - "pos"
8
+ - "wikipedia"
9
+ license: "cc-by-sa-3.0"
10
+ pipeline_tag: "token-classification"
11
+ widget:
12
+ - text: "国境の長いトンネルを抜けると雪国であった。"
13
+ ---
14
+
15
+ # bert-base-japanese-upos
16
+
17
+ ## Model Description
18
+
19
+ This is a BERT model pre-trained on Japanese Wikipedia texts for POS-tagging, derived from [bert-base-japanese-char-extended](https://huggingface.co/KoichiYasuoka/bert-base-japanese-char-extended). Every word is tagged by [UPOS](https://universaldependencies.org/u/pos/) (Universal Part-Of-Speech).
20
+
21
+ ## How to Use
22
+
23
+ ```py
24
+ import torch
25
+ from transformers import AutoTokenizer,AutoModelForTokenClassification
26
+ tokenizer=AutoTokenizer.from_pretrained("KoichiYasuoka/bert-base-japanese-upos")
27
+ model=AutoModelForTokenClassification.from_pretrained("KoichiYasuoka/bert-base-japanese-upos")
28
+ s="国境の長いトンネルを抜けると雪国であった。"
29
+ p=[model.config.id2label[q] for q in torch.argmax(model(tokenizer.encode(s,return_tensors="pt"))[0],dim=2)[0].tolist()[1:-1]]
30
+ print(list(zip(s,p)))
31
+ ```
32
+
config.json ADDED
@@ -0,0 +1,117 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "architectures": [
3
+ "BertForTokenClassification"
4
+ ],
5
+ "attention_probs_dropout_prob": 0.1,
6
+ "gradient_checkpointing": false,
7
+ "hidden_act": "gelu",
8
+ "hidden_dropout_prob": 0.1,
9
+ "hidden_size": 768,
10
+ "id2label": {
11
+ "0": "B-ADJ",
12
+ "1": "I-CCONJ",
13
+ "2": "AUX",
14
+ "3": "B-DET",
15
+ "4": "ADV",
16
+ "5": "B-NUM",
17
+ "6": "I-PRON",
18
+ "7": "I-X",
19
+ "8": "ADP",
20
+ "9": "I-DET",
21
+ "10": "B-ADV",
22
+ "11": "I-PROPN",
23
+ "12": "B-PRON",
24
+ "13": "I-ADJ",
25
+ "14": "I-NUM",
26
+ "15": "PART",
27
+ "16": "B-AUX",
28
+ "17": "INTJ",
29
+ "18": "PRON",
30
+ "19": "NUM",
31
+ "20": "VERB",
32
+ "21": "B-NOUN",
33
+ "22": "PUNCT",
34
+ "23": "ADJ",
35
+ "24": "I-NOUN",
36
+ "25": "PROPN",
37
+ "26": "B-VERB",
38
+ "27": "SYM",
39
+ "28": "NOUN",
40
+ "29": "CCONJ",
41
+ "30": "I-PART",
42
+ "31": "B-PROPN",
43
+ "32": "B-ADP",
44
+ "33": "B-CCONJ",
45
+ "34": "SCONJ",
46
+ "35": "B-INTJ",
47
+ "36": "B-X",
48
+ "37": "I-ADP",
49
+ "38": "I-ADV",
50
+ "39": "I-INTJ",
51
+ "40": "B-PART",
52
+ "41": "DET",
53
+ "42": "I-VERB",
54
+ "43": "I-AUX"
55
+ },
56
+ "initializer_range": 0.02,
57
+ "intermediate_size": 3072,
58
+ "label2id": {
59
+ "ADJ": 23,
60
+ "ADP": 8,
61
+ "ADV": 4,
62
+ "AUX": 2,
63
+ "B-ADJ": 0,
64
+ "B-ADP": 32,
65
+ "B-ADV": 10,
66
+ "B-AUX": 16,
67
+ "B-CCONJ": 33,
68
+ "B-DET": 3,
69
+ "B-INTJ": 35,
70
+ "B-NOUN": 21,
71
+ "B-NUM": 5,
72
+ "B-PART": 40,
73
+ "B-PRON": 12,
74
+ "B-PROPN": 31,
75
+ "B-VERB": 26,
76
+ "B-X": 36,
77
+ "CCONJ": 29,
78
+ "DET": 41,
79
+ "I-ADJ": 13,
80
+ "I-ADP": 37,
81
+ "I-ADV": 38,
82
+ "I-AUX": 43,
83
+ "I-CCONJ": 1,
84
+ "I-DET": 9,
85
+ "I-INTJ": 39,
86
+ "I-NOUN": 24,
87
+ "I-NUM": 14,
88
+ "I-PART": 30,
89
+ "I-PRON": 6,
90
+ "I-PROPN": 11,
91
+ "I-VERB": 42,
92
+ "I-X": 7,
93
+ "INTJ": 17,
94
+ "NOUN": 28,
95
+ "NUM": 19,
96
+ "PART": 15,
97
+ "PRON": 18,
98
+ "PROPN": 25,
99
+ "PUNCT": 22,
100
+ "SCONJ": 34,
101
+ "SYM": 27,
102
+ "VERB": 20
103
+ },
104
+ "layer_norm_eps": 1e-12,
105
+ "max_position_embeddings": 512,
106
+ "model_type": "bert",
107
+ "num_attention_heads": 12,
108
+ "num_hidden_layers": 12,
109
+ "pad_token_id": 0,
110
+ "position_embedding_type": "absolute",
111
+ "tokenizer_class": "BertJapaneseTokenizer",
112
+ "torch_dtype": "float32",
113
+ "transformers_version": "4.9.2",
114
+ "type_vocab_size": 2,
115
+ "use_cache": true,
116
+ "vocab_size": 6291
117
+ }
pytorch_model.bin ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:fc4ac98255499fa83190e15a69b5c67a76717fa90c68e9581ee23c435da9c0af
3
+ size 361350487
special_tokens_map.json ADDED
@@ -0,0 +1 @@
 
 
1
+ {"unk_token": "[UNK]", "sep_token": "[SEP]", "pad_token": "[PAD]", "cls_token": "[CLS]", "mask_token": "[MASK]"}
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": "basic", "subword_tokenizer_type": "character", "never_split": ["[PAD]", "[UNK]", "[CLS]", "[SEP]", "[MASK]"], "mecab_kwargs": null, "special_tokens_map_file": null, "tokenizer_file": null, "tokenizer_class": "BertJapaneseTokenizer"}
vocab.txt ADDED
@@ -0,0 +1,6291 @@