KoichiYasuoka commited on
Commit
4b6ba2d
1 Parent(s): 8e154e8

initial release

Browse files
README.md ADDED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ language:
3
+ - "lzh"
4
+ tags:
5
+ - "classical chinese"
6
+ - "literary chinese"
7
+ - "ancient chinese"
8
+ - "token-classification"
9
+ - "pos"
10
+ license: "apache-2.0"
11
+ pipeline_tag: "token-classification"
12
+ widget:
13
+ - text: "子曰學而時習之不亦說乎有朋自遠方來不亦樂乎人不知而不慍不亦君子乎"
14
+ ---
15
+
16
+ # roberta-classical-chinese-base-upos
17
+
18
+ ## Model Description
19
+
20
+ This is a RoBERTa model pre-trained on Classical Chinese texts for POS-tagging, derived from [roberta-classical-chinese-base-char](https://huggingface.co/KoichiYasuoka/roberta-classical-chinese-base-char). Every word is tagged by [UPOS](https://universaldependencies.org/u/pos/) (Universal Part-Of-Speech).
21
+
22
+ ## How to Use
23
+
24
+ ```py
25
+ import torch
26
+ from transformers import AutoTokenizer,AutoModelForTokenClassification
27
+ tokenizer=AutoTokenizer.from_pretrained("KoichiYasuoka/roberta-classical-chinese-base-upos")
28
+ model=AutoModelForTokenClassification.from_pretrained("KoichiYasuoka/roberta-classical-chinese-base-upos")
29
+ 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(s,p)))
32
+ ```
33
+
config.json ADDED
@@ -0,0 +1,85 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "_name_or_path": "KoichiYasuoka/roberta-classical-chinese-base-char",
3
+ "architectures": [
4
+ "RobertaForTokenClassification"
5
+ ],
6
+ "attention_probs_dropout_prob": 0.1,
7
+ "bos_token_id": 0,
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": "ADP",
15
+ "1": "SCONJ",
16
+ "2": "PROPN",
17
+ "3": "PART",
18
+ "4": "B-PROPN",
19
+ "5": "I-NUM",
20
+ "6": "E-VERB",
21
+ "7": "E-NUM",
22
+ "8": "B-NOUN",
23
+ "9": "B-VERB",
24
+ "10": "NUM",
25
+ "11": "E-PROPN",
26
+ "12": "ADV",
27
+ "13": "E-NOUN",
28
+ "14": "I-PROPN",
29
+ "15": "INTJ",
30
+ "16": "VERB",
31
+ "17": "AUX",
32
+ "18": "I-VERB",
33
+ "19": "PRON",
34
+ "20": "E-ADV",
35
+ "21": "CCONJ",
36
+ "22": "NOUN",
37
+ "23": "SYM",
38
+ "24": "B-ADV",
39
+ "25": "I-NOUN",
40
+ "26": "B-NUM"
41
+ },
42
+ "initializer_range": 0.02,
43
+ "intermediate_size": 3072,
44
+ "label2id": {
45
+ "ADP": 0,
46
+ "ADV": 12,
47
+ "AUX": 17,
48
+ "B-ADV": 24,
49
+ "B-NOUN": 8,
50
+ "B-NUM": 26,
51
+ "B-PROPN": 4,
52
+ "B-VERB": 9,
53
+ "CCONJ": 21,
54
+ "E-ADV": 20,
55
+ "E-NOUN": 13,
56
+ "E-NUM": 7,
57
+ "E-PROPN": 11,
58
+ "E-VERB": 6,
59
+ "I-NOUN": 25,
60
+ "I-NUM": 5,
61
+ "I-PROPN": 14,
62
+ "I-VERB": 18,
63
+ "INTJ": 15,
64
+ "NOUN": 22,
65
+ "NUM": 10,
66
+ "PART": 3,
67
+ "PRON": 19,
68
+ "PROPN": 2,
69
+ "SCONJ": 1,
70
+ "SYM": 23,
71
+ "VERB": 16
72
+ },
73
+ "layer_norm_eps": 1e-05,
74
+ "max_position_embeddings": 514,
75
+ "model_type": "roberta",
76
+ "num_attention_heads": 12,
77
+ "num_hidden_layers": 12,
78
+ "pad_token_id": 1,
79
+ "position_embedding_type": "absolute",
80
+ "tokenizer_class": "BertTokenizer",
81
+ "transformers_version": "4.7.0",
82
+ "type_vocab_size": 1,
83
+ "use_cache": true,
84
+ "vocab_size": 26318
85
+ }
pytorch_model.bin ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:52c2dba91a9c965db132240fdefdf8631ae7d0332946ed07bf86ca15cb6679ef
3
+ size 422825417
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
+ {"do_lower_case": true, "unk_token": "[UNK]", "sep_token": "[SEP]", "pad_token": "[PAD]", "cls_token": "[CLS]", "mask_token": "[MASK]", "tokenize_chinese_chars": true, "strip_accents": null, "special_tokens_map_file": null, "name_or_path": "KoichiYasuoka/roberta-classical-chinese-base-char", "do_basic_tokenize": true, "never_split": null}
vocab.txt ADDED
The diff for this file is too large to render. See raw diff