KoichiYasuoka
commited on
Commit
•
fc1c6ef
1
Parent(s):
0a28d68
initial release
Browse files- README.md +48 -3
- config.json +0 -0
- pytorch_model.bin +3 -0
- sentencepiece.model +3 -0
- special_tokens_map.json +1 -0
- supar.model +3 -0
- tokenizer.json +0 -0
- tokenizer_config.json +1 -0
README.md
CHANGED
@@ -1,3 +1,48 @@
|
|
1 |
-
---
|
2 |
-
|
3 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
language:
|
3 |
+
- "th"
|
4 |
+
tags:
|
5 |
+
- "thai"
|
6 |
+
- "token-classification"
|
7 |
+
- "pos"
|
8 |
+
- "wikipedia"
|
9 |
+
- "dependency-parsing"
|
10 |
+
datasets:
|
11 |
+
- "universal_dependencies"
|
12 |
+
license: "apache-2.0"
|
13 |
+
pipeline_tag: "token-classification"
|
14 |
+
widget:
|
15 |
+
- text: "หลายหัวดีกว่าหัวเดียว"
|
16 |
+
---
|
17 |
+
|
18 |
+
# roberta-base-thai-spm-upos
|
19 |
+
|
20 |
+
## Model Description
|
21 |
+
|
22 |
+
This is a RoBERTa model pre-trained on Thai Wikipedia texts for POS-tagging and dependency-parsing, derived from [roberta-base-thai-spm](https://huggingface.co/KoichiYasuoka/roberta-base-thai-spm). Every 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/roberta-base-thai-spm-upos")
|
30 |
+
model=AutoModelForTokenClassification.from_pretrained("KoichiYasuoka/roberta-base-thai-spm-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 |
+
```
|
40 |
+
import esupar
|
41 |
+
nlp=esupar.load("KoichiYasuoka/roberta-base-thai-spm-upos")
|
42 |
+
print(nlp("หลายหัวดีกว่าหัวเดียว"))
|
43 |
+
```
|
44 |
+
|
45 |
+
## See Also
|
46 |
+
|
47 |
+
[esupar](https://github.com/KoichiYasuoka/esupar): Tokenizer POS-tagger and Dependency-parser with BERT/RoBERTa models
|
48 |
+
|
config.json
ADDED
The diff for this file is too large to render.
See raw diff
|
|
pytorch_model.bin
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:fddc9e8d078b09c2eb08804e829c563d7dddc4e95cf47ac748742d16377fe971
|
3 |
+
size 351897201
|
sentencepiece.model
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:01ba4719c80b6fe911b091a7c05124b64eeece964e09c058ef8f9805daca546b
|
3 |
+
size 1
|
special_tokens_map.json
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
{"bos_token": "[CLS]", "eos_token": "[SEP]", "unk_token": "[UNK]", "sep_token": "[SEP]", "pad_token": "[PAD]", "cls_token": "[CLS]", "mask_token": {"content": "[MASK]", "single_word": false, "lstrip": true, "rstrip": false, "normalized": true}}
|
supar.model
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:6fb2f6061ac79be69468d8d4317ff768f5602cb8e0b332ad493872808e32ca93
|
3 |
+
size 399777573
|
tokenizer.json
ADDED
The diff for this file is too large to render.
See raw diff
|
|
tokenizer_config.json
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
{"do_lower_case": false, "remove_space": true, "keep_accents": true, "bos_token": "[CLS]", "eos_token": "[SEP]", "unk_token": "[UNK]", "sep_token": "[SEP]", "pad_token": "[PAD]", "cls_token": "[CLS]", "mask_token": {"content": "[MASK]", "single_word": false, "lstrip": true, "rstrip": false, "normalized": true, "__type": "AddedToken"}, "model_max_length": 512, "special_tokens_map_file": "tokenizer-th-spm/special_tokens_map.json", "name_or_path": "KoichiYasuoka/roberta-base-thai-spm", "tokenizer_class": "RemBertTokenizer"}
|