KoichiYasuoka commited on
Commit
4587d90
1 Parent(s): d318c10

initial release

Browse files
Files changed (6) hide show
  1. README.md +33 -0
  2. config.json +116 -0
  3. pytorch_model.bin +3 -0
  4. special_tokens_map.json +1 -0
  5. tokenizer_config.json +1 -0
  6. vocab.txt +0 -0
README.md ADDED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ language:
3
+ - "th"
4
+ tags:
5
+ - "thai"
6
+ - "token-classification"
7
+ - "pos"
8
+ - "wikipedia"
9
+ license: "apache-2.0"
10
+ pipeline_tag: "token-classification"
11
+ widget:
12
+ - text: "หลายหัวดีกว่าหัวเดียว"
13
+ ---
14
+
15
+ # roberta-base-thai-syllable-upos
16
+
17
+ ## Model Description
18
+
19
+ This is a RoBERTa model pre-trained on Thai Wikipedia texts for POS-tagging, derived from [roberta-base-thai-syllable](https://huggingface.co/KoichiYasuoka/roberta-base-thai-syllable). 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/roberta-base-thai-syllable-upos")
27
+ model=AutoModelForTokenClassification.from_pretrained("KoichiYasuoka/roberta-base-thai-syllable-upos")
28
+ s="หลายหัวดีกว่าหัวเดียว"
29
+ t=tokenizer.tokenize(s)
30
+ p=[model.config.id2label[q] for q in torch.argmax(model(tokenizer.encode(s,return_tensors="pt"))[0],dim=2)[0].tolist()[1:-1]]
31
+ print(list(zip(t,p)))
32
+ ```
33
+
config.json ADDED
@@ -0,0 +1,116 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "architectures": [
3
+ "RobertaForTokenClassification"
4
+ ],
5
+ "attention_probs_dropout_prob": 0.1,
6
+ "bos_token_id": 0,
7
+ "classifier_dropout": null,
8
+ "eos_token_id": 2,
9
+ "gradient_checkpointing": false,
10
+ "hidden_act": "gelu",
11
+ "hidden_dropout_prob": 0.1,
12
+ "hidden_size": 768,
13
+ "id2label": {
14
+ "0": "B-NUM",
15
+ "1": "I-NUM",
16
+ "2": "PART",
17
+ "3": "B-NOUN",
18
+ "4": "B-DET",
19
+ "5": "PROPN",
20
+ "6": "ADJ",
21
+ "7": "I-ADP",
22
+ "8": "B-VERB",
23
+ "9": "I-ADV",
24
+ "10": "PRON",
25
+ "11": "I-AUX",
26
+ "12": "I-PROPN",
27
+ "13": "B-CCONJ",
28
+ "14": "DET",
29
+ "15": "B-ADP",
30
+ "16": "SYM",
31
+ "17": "I-DET",
32
+ "18": "B-AUX",
33
+ "19": "AUX",
34
+ "20": "VERB",
35
+ "21": "I-VERB",
36
+ "22": "I-PART",
37
+ "23": "B-PROPN",
38
+ "24": "I-PUNCT",
39
+ "25": "I-PRON",
40
+ "26": "CCONJ",
41
+ "27": "ADV",
42
+ "28": "NUM",
43
+ "29": "SCONJ",
44
+ "30": "PUNCT",
45
+ "31": "NOUN",
46
+ "32": "I-ADJ",
47
+ "33": "B-PRON",
48
+ "34": "B-ADJ",
49
+ "35": "B-PART",
50
+ "36": "B-ADV",
51
+ "37": "I-NOUN",
52
+ "38": "ADP",
53
+ "39": "B-PUNCT",
54
+ "40": "I-CCONJ"
55
+ },
56
+ "initializer_range": 0.02,
57
+ "intermediate_size": 3072,
58
+ "label2id": {
59
+ "ADJ": 6,
60
+ "ADP": 38,
61
+ "ADV": 27,
62
+ "AUX": 19,
63
+ "B-ADJ": 34,
64
+ "B-ADP": 15,
65
+ "B-ADV": 36,
66
+ "B-AUX": 18,
67
+ "B-CCONJ": 13,
68
+ "B-DET": 4,
69
+ "B-NOUN": 3,
70
+ "B-NUM": 0,
71
+ "B-PART": 35,
72
+ "B-PRON": 33,
73
+ "B-PROPN": 23,
74
+ "B-PUNCT": 39,
75
+ "B-VERB": 8,
76
+ "CCONJ": 26,
77
+ "DET": 14,
78
+ "I-ADJ": 32,
79
+ "I-ADP": 7,
80
+ "I-ADV": 9,
81
+ "I-AUX": 11,
82
+ "I-CCONJ": 40,
83
+ "I-DET": 17,
84
+ "I-NOUN": 37,
85
+ "I-NUM": 1,
86
+ "I-PART": 22,
87
+ "I-PRON": 25,
88
+ "I-PROPN": 12,
89
+ "I-PUNCT": 24,
90
+ "I-VERB": 21,
91
+ "NOUN": 31,
92
+ "NUM": 28,
93
+ "PART": 2,
94
+ "PRON": 10,
95
+ "PROPN": 5,
96
+ "PUNCT": 30,
97
+ "SCONJ": 29,
98
+ "SYM": 16,
99
+ "VERB": 20
100
+ },
101
+ "layer_norm_eps": 1e-05,
102
+ "mask_token_id": 4,
103
+ "max_position_embeddings": 514,
104
+ "model_type": "roberta",
105
+ "num_attention_heads": 12,
106
+ "num_hidden_layers": 12,
107
+ "pad_token_id": 1,
108
+ "position_embedding_type": "absolute",
109
+ "tokenizer_class": "BertTokenizerFast",
110
+ "torch_dtype": "float32",
111
+ "transformers_version": "4.10.0",
112
+ "type_vocab_size": 1,
113
+ "unk_token_id": 3,
114
+ "use_cache": true,
115
+ "vocab_size": 33144
116
+ }
pytorch_model.bin ADDED
@@ -0,0 +1,3 @@
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:d4860ad4ef9b423ca8a89f032a9b835d23ecbc82ae21dac6e9a6c8279241959c
3
+ size 443838354
special_tokens_map.json ADDED
@@ -0,0 +1 @@
 
1
+ {"unk_token": "<unk>", "sep_token": "</s>", "pad_token": "<pad>", "cls_token": "<s>", "mask_token": "<mask>"}
tokenizer_config.json ADDED
@@ -0,0 +1 @@
 
1
+ {"do_lower_case": false, "unk_token": "<unk>", "sep_token": "</s>", "pad_token": "<pad>", "cls_token": "<s>", "mask_token": "<mask>", "tokenize_chinese_chars": true, "strip_accents": false, "model_max_length": 416, "do_basic_tokenize": true, "never_split": null, "tokenizer_class": "BertTokenizer"}
vocab.txt ADDED
The diff for this file is too large to render. See raw diff