KoichiYasuoka commited on
Commit
4e340fe
1 Parent(s): 6b25fbb

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-large-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-large-char](https://huggingface.co/KoichiYasuoka/roberta-classical-chinese-large-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-large-upos")
28
+ model=AutoModelForTokenClassification.from_pretrained("KoichiYasuoka/roberta-classical-chinese-large-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,77 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "_name_or_path": "KoichiYasuoka/roberta-classical-chinese-large-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": 1024,
13
+ "id2label": {
14
+ "0": "NUM",
15
+ "1": "ADV",
16
+ "2": "I-NUM",
17
+ "3": "B-ADV",
18
+ "4": "I-ADV",
19
+ "5": "I-VERB",
20
+ "6": "B-NOUN",
21
+ "7": "SYM",
22
+ "8": "SCONJ",
23
+ "9": "PRON",
24
+ "10": "B-NUM",
25
+ "11": "PART",
26
+ "12": "CCONJ",
27
+ "13": "NOUN",
28
+ "14": "I-PROPN",
29
+ "15": "AUX",
30
+ "16": "VERB",
31
+ "17": "INTJ",
32
+ "18": "PROPN",
33
+ "19": "B-VERB",
34
+ "20": "ADP",
35
+ "21": "I-NOUN",
36
+ "22": "B-PROPN"
37
+ },
38
+ "initializer_range": 0.02,
39
+ "intermediate_size": 4096,
40
+ "label2id": {
41
+ "ADP": 20,
42
+ "ADV": 1,
43
+ "AUX": 15,
44
+ "B-ADV": 3,
45
+ "B-NOUN": 6,
46
+ "B-NUM": 10,
47
+ "B-PROPN": 22,
48
+ "B-VERB": 19,
49
+ "CCONJ": 12,
50
+ "I-ADV": 4,
51
+ "I-NOUN": 21,
52
+ "I-NUM": 2,
53
+ "I-PROPN": 14,
54
+ "I-VERB": 5,
55
+ "INTJ": 17,
56
+ "NOUN": 13,
57
+ "NUM": 0,
58
+ "PART": 11,
59
+ "PRON": 9,
60
+ "PROPN": 18,
61
+ "SCONJ": 8,
62
+ "SYM": 7,
63
+ "VERB": 16
64
+ },
65
+ "layer_norm_eps": 1e-05,
66
+ "max_position_embeddings": 514,
67
+ "model_type": "roberta",
68
+ "num_attention_heads": 16,
69
+ "num_hidden_layers": 24,
70
+ "pad_token_id": 1,
71
+ "position_embedding_type": "absolute",
72
+ "tokenizer_class": "BertTokenizer",
73
+ "transformers_version": "4.7.0",
74
+ "type_vocab_size": 1,
75
+ "use_cache": true,
76
+ "vocab_size": 26318
77
+ }
pytorch_model.bin ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:262a3869cc514be0ad0013485bad8ad2c3fc719ef08af25fd1efd3f8dbe59bb7
3
+ size 1319416722
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-large-char", "do_basic_tokenize": true, "never_split": null}
vocab.txt ADDED
The diff for this file is too large to render. See raw diff