init
Browse files- .gitattributes +3 -10
- README.md +43 -0
- config.json +78 -0
- pytorch_model.bin +3 -0
- special_tokens_map.json +1 -0
- tokenizer_config.json +1 -0
- vocab.txt +0 -0
.gitattributes
CHANGED
@@ -1,34 +1,27 @@
|
|
1 |
*.7z filter=lfs diff=lfs merge=lfs -text
|
2 |
*.arrow filter=lfs diff=lfs merge=lfs -text
|
3 |
*.bin filter=lfs diff=lfs merge=lfs -text
|
|
|
4 |
*.bz2 filter=lfs diff=lfs merge=lfs -text
|
5 |
-
*.ckpt filter=lfs diff=lfs merge=lfs -text
|
6 |
*.ftz filter=lfs diff=lfs merge=lfs -text
|
7 |
*.gz filter=lfs diff=lfs merge=lfs -text
|
8 |
*.h5 filter=lfs diff=lfs merge=lfs -text
|
9 |
*.joblib filter=lfs diff=lfs merge=lfs -text
|
10 |
*.lfs.* filter=lfs diff=lfs merge=lfs -text
|
11 |
-
*.mlmodel filter=lfs diff=lfs merge=lfs -text
|
12 |
*.model filter=lfs diff=lfs merge=lfs -text
|
13 |
*.msgpack filter=lfs diff=lfs merge=lfs -text
|
14 |
-
*.npy filter=lfs diff=lfs merge=lfs -text
|
15 |
-
*.npz filter=lfs diff=lfs merge=lfs -text
|
16 |
*.onnx filter=lfs diff=lfs merge=lfs -text
|
17 |
*.ot filter=lfs diff=lfs merge=lfs -text
|
18 |
*.parquet filter=lfs diff=lfs merge=lfs -text
|
19 |
*.pb filter=lfs diff=lfs merge=lfs -text
|
20 |
-
*.pickle filter=lfs diff=lfs merge=lfs -text
|
21 |
-
*.pkl filter=lfs diff=lfs merge=lfs -text
|
22 |
*.pt filter=lfs diff=lfs merge=lfs -text
|
23 |
*.pth filter=lfs diff=lfs merge=lfs -text
|
24 |
*.rar filter=lfs diff=lfs merge=lfs -text
|
25 |
-
|
26 |
-
saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
27 |
*.tar.* filter=lfs diff=lfs merge=lfs -text
|
28 |
*.tflite filter=lfs diff=lfs merge=lfs -text
|
29 |
*.tgz filter=lfs diff=lfs merge=lfs -text
|
30 |
-
*.wasm filter=lfs diff=lfs merge=lfs -text
|
31 |
*.xz filter=lfs diff=lfs merge=lfs -text
|
32 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
33 |
-
*.
|
34 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
|
|
1 |
*.7z filter=lfs diff=lfs merge=lfs -text
|
2 |
*.arrow filter=lfs diff=lfs merge=lfs -text
|
3 |
*.bin filter=lfs diff=lfs merge=lfs -text
|
4 |
+
*.bin.* filter=lfs diff=lfs merge=lfs -text
|
5 |
*.bz2 filter=lfs diff=lfs merge=lfs -text
|
|
|
6 |
*.ftz filter=lfs diff=lfs merge=lfs -text
|
7 |
*.gz filter=lfs diff=lfs merge=lfs -text
|
8 |
*.h5 filter=lfs diff=lfs merge=lfs -text
|
9 |
*.joblib filter=lfs diff=lfs merge=lfs -text
|
10 |
*.lfs.* filter=lfs diff=lfs merge=lfs -text
|
|
|
11 |
*.model filter=lfs diff=lfs merge=lfs -text
|
12 |
*.msgpack filter=lfs diff=lfs merge=lfs -text
|
|
|
|
|
13 |
*.onnx filter=lfs diff=lfs merge=lfs -text
|
14 |
*.ot filter=lfs diff=lfs merge=lfs -text
|
15 |
*.parquet filter=lfs diff=lfs merge=lfs -text
|
16 |
*.pb filter=lfs diff=lfs merge=lfs -text
|
|
|
|
|
17 |
*.pt filter=lfs diff=lfs merge=lfs -text
|
18 |
*.pth filter=lfs diff=lfs merge=lfs -text
|
19 |
*.rar filter=lfs diff=lfs merge=lfs -text
|
20 |
+
saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
|
|
21 |
*.tar.* filter=lfs diff=lfs merge=lfs -text
|
22 |
*.tflite filter=lfs diff=lfs merge=lfs -text
|
23 |
*.tgz filter=lfs diff=lfs merge=lfs -text
|
|
|
24 |
*.xz filter=lfs diff=lfs merge=lfs -text
|
25 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
26 |
+
*.zstandard filter=lfs diff=lfs merge=lfs -text
|
27 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
README.md
CHANGED
@@ -1,3 +1,46 @@
|
|
1 |
---
|
|
|
|
|
|
|
|
|
|
|
|
|
2 |
license: apache-2.0
|
3 |
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
---
|
2 |
+
tags:
|
3 |
+
- text2text-generation
|
4 |
+
- Chinese
|
5 |
+
- seq2seq
|
6 |
+
- grammar
|
7 |
+
language: zh
|
8 |
license: apache-2.0
|
9 |
---
|
10 |
+
# Pseudo-Native-BART-CGEC
|
11 |
+
|
12 |
+
This model is a cutting-edge CGEC model based on [Chinese BART-large](https://huggingface.co/fnlp/bart-large-chinese).
|
13 |
+
It is trained with about 100M pseudo native speaker CGEC training data generated by heuristic rules and human-annotated training data for the media domain.
|
14 |
+
More details can be found in our [Github](https://github.com/HillZhang1999/NaSGEC) and the [paper]().
|
15 |
+
|
16 |
+
## Usage
|
17 |
+
|
18 |
+
pip install transformers
|
19 |
+
|
20 |
+
```
|
21 |
+
from transformers import BertTokenizer, BartForConditionalGeneration, Text2TextGenerationPipeline
|
22 |
+
tokenizer = BertTokenizer.from_pretrained("HillZhang/pseudo_native_bart_CGEC_media")
|
23 |
+
model = BartForConditionalGeneration.from_pretrained("HillZhang/pseudo_native_bart_CGEC_media")
|
24 |
+
encoded_input = tokenizer(["北京是中国的都。", "他说:”我最爱的运动是打蓝球“", "我每天大约喝5次水左右。", "今天,我非常开开心。"], return_tensors="pt", padding=True, truncation=True)
|
25 |
+
if "token_type_ids" in encoded_input:
|
26 |
+
del encoded_input["token_type_ids"]
|
27 |
+
output = model.generate(**encoded_input)
|
28 |
+
print(tokenizer.batch_decode(output, skip_special_tokens=True))
|
29 |
+
```
|
30 |
+
|
31 |
+
## Citation
|
32 |
+
|
33 |
+
```
|
34 |
+
@inproceedings{zhang-etal-2023-nasgec,
|
35 |
+
title = "{Na}{SGEC}: a Multi-Domain Chinese Grammatical Error Correction Dataset from Native Speaker Texts",
|
36 |
+
author = "Zhang, Yue and
|
37 |
+
Zhang, Bo and
|
38 |
+
Jiang, Haochen and
|
39 |
+
Li, Zhenghua and
|
40 |
+
Li, Chen and
|
41 |
+
Huang, Fei and
|
42 |
+
Zhang, Min"
|
43 |
+
booktitle = "Findings of ACL",
|
44 |
+
year = "2023"
|
45 |
+
}
|
46 |
+
```
|
config.json
ADDED
@@ -0,0 +1,78 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"activation_dropout": 0.1,
|
3 |
+
"activation_function": "gelu",
|
4 |
+
"add_bias_logits": false,
|
5 |
+
"add_final_layer_norm": false,
|
6 |
+
"architectures": [
|
7 |
+
"BartForConditionalGeneration"
|
8 |
+
],
|
9 |
+
"attention_dropout": 0.1,
|
10 |
+
"bos_token_id": 0,
|
11 |
+
"unk_token_id": 3,
|
12 |
+
"classif_dropout": 0.1,
|
13 |
+
"classifier_dropout": 0.0,
|
14 |
+
"d_model": 1024,
|
15 |
+
"decoder_attention_heads": 16,
|
16 |
+
"decoder_ffn_dim": 4096,
|
17 |
+
"decoder_layerdrop": 0.0,
|
18 |
+
"decoder_layers": 12,
|
19 |
+
"decoder_start_token_id": 2,
|
20 |
+
"do_blenderbot_90_layernorm": false,
|
21 |
+
"dropout": 0.1,
|
22 |
+
"early_stopping": true,
|
23 |
+
"encoder_attention_heads": 16,
|
24 |
+
"encoder_ffn_dim": 4096,
|
25 |
+
"encoder_layerdrop": 0.0,
|
26 |
+
"encoder_layers": 12,
|
27 |
+
"eos_token_id": 2,
|
28 |
+
"extra_pos_embeddings": 2,
|
29 |
+
"force_bos_token_to_be_generated": true,
|
30 |
+
"forced_bos_token_id": 0,
|
31 |
+
"forced_eos_token_id": 2,
|
32 |
+
"gradient_checkpointing": false,
|
33 |
+
"id2label": {
|
34 |
+
"0": "LABEL_0",
|
35 |
+
"1": "LABEL_1",
|
36 |
+
"2": "LABEL_2"
|
37 |
+
},
|
38 |
+
"init_std": 0.02,
|
39 |
+
"is_encoder_decoder": true,
|
40 |
+
"label2id": {
|
41 |
+
"LABEL_0": 0,
|
42 |
+
"LABEL_1": 1,
|
43 |
+
"LABEL_2": 2
|
44 |
+
},
|
45 |
+
"max_position_embeddings": 512,
|
46 |
+
"model_type": "bart",
|
47 |
+
"no_repeat_ngram_size": 3,
|
48 |
+
"normalize_before": false,
|
49 |
+
"normalize_embedding": true,
|
50 |
+
"num_beams": 4,
|
51 |
+
"num_hidden_layers": 12,
|
52 |
+
"pad_token_id": 1,
|
53 |
+
"scale_embedding": false,
|
54 |
+
"static_position_embeddings": false,
|
55 |
+
"task_specific_params": {
|
56 |
+
"summarization": {
|
57 |
+
"length_penalty": 1.0,
|
58 |
+
"max_length": 128,
|
59 |
+
"min_length": 12,
|
60 |
+
"num_beams": 4
|
61 |
+
},
|
62 |
+
"summarization_cnn": {
|
63 |
+
"length_penalty": 2.0,
|
64 |
+
"max_length": 142,
|
65 |
+
"min_length": 56,
|
66 |
+
"num_beams": 4
|
67 |
+
},
|
68 |
+
"summarization_xsum": {
|
69 |
+
"length_penalty": 1.0,
|
70 |
+
"max_length": 62,
|
71 |
+
"min_length": 11,
|
72 |
+
"num_beams": 6
|
73 |
+
}
|
74 |
+
},
|
75 |
+
"transformers_version": "4.4.1",
|
76 |
+
"use_cache": true,
|
77 |
+
"vocab_size": 21132
|
78 |
+
}
|
pytorch_model.bin
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:709777ea68466a3c5315e65cfaa01e5b2efc8caf8567723840e4ffe031ce14b1
|
3 |
+
size 1501922415
|
special_tokens_map.json
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
{"bos_token": "<s>", "eos_token": "</s>", "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": false, "do_basic_tokenize": true, "never_split": null, "unk_token": "<unk>", "sep_token": "[SEP]", "pad_token": "<pad>", "cls_token": "[CLS]", "mask_token": "[MASK]", "tokenize_chinese_chars": true, "strip_accents": null, "bos_token": "<s>", "eos_token": "</s>"}
|
vocab.txt
ADDED
The diff for this file is too large to render.
See raw diff
|
|