TedYeh
commited on
Commit
•
db65d3d
1
Parent(s):
fa540d6
update csc t5 model
Browse files- README.md +28 -0
- added_tokens.json +0 -0
- config.json +31 -0
- eval_results.txt +1 -0
- generation_config.json +7 -0
- model_args.json +1 -0
- pytorch_model.bin +3 -0
- special_tokens_map.json +5 -0
- spiece.model +3 -0
- tokenizer_config.json +12 -0
- training_args.bin +3 -0
README.md
CHANGED
@@ -1,3 +1,31 @@
|
|
1 |
---
|
2 |
license: apache-2.0
|
3 |
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
---
|
2 |
license: apache-2.0
|
3 |
---
|
4 |
+
|
5 |
+
# CSC T5 - T5 for Traditional Chinese Spelling Correction
|
6 |
+
|
7 |
+
This model was obtained by `instruction-tuning` the corresponding `ClueAI/PromptCLUE-base-v1-5` model on the spelling error corpus.
|
8 |
+
|
9 |
+
## Model Details
|
10 |
+
### Model Description
|
11 |
+
- Language(s) (NLP): `Chinese`
|
12 |
+
- Pretrained from model: `ClueAI/PromptCLUE-base-v1-5`
|
13 |
+
- Pretrained by dataset: `1M UDN news corpus`
|
14 |
+
- Finetuned by dataset: `shibing624/CSC` spelling error corpus
|
15 |
+
|
16 |
+
### Model Sources
|
17 |
+
- Repository: [https://github.com/TedYeh/Chinese_spelling_Correction](https://github.com/TedYeh/Chinese_spelling_Correction)
|
18 |
+
|
19 |
+
## Usage
|
20 |
+
```python
|
21 |
+
from transformers import AutoTokenizer, T5ForConditionalGeneration
|
22 |
+
tokenizer = AutoTokenizer.from_pretrained("CodeTed/traditional_CSC_t5")
|
23 |
+
model = T5ForConditionalGeneration.from_pretrained("CodeTed/traditional_CSC_t5")
|
24 |
+
input_text = '糾正句子裡的錯字: 為了降低少子化,政府可以堆動獎勵生育的政策。'
|
25 |
+
input_ids = tokenizer(input_text, return_tensors="pt").input_ids
|
26 |
+
outputs = model.generate(input_ids, max_length=256)
|
27 |
+
edited_text = tokenizer.decode(outputs[0], skip_special_tokens=True)
|
28 |
+
```
|
29 |
+
|
30 |
+
### Related Project
|
31 |
+
[CodeTed/CGEDit](https://huggingface.co/CodeTed/CGEDit)
|
added_tokens.json
ADDED
The diff for this file is too large to render.
See raw diff
|
|
config.json
ADDED
@@ -0,0 +1,31 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"_name_or_path": "./outputs/prompt_1m",
|
3 |
+
"architectures": [
|
4 |
+
"T5ForConditionalGeneration"
|
5 |
+
],
|
6 |
+
"d_ff": 2048,
|
7 |
+
"d_kv": 64,
|
8 |
+
"d_model": 768,
|
9 |
+
"decoder_start_token_id": 0,
|
10 |
+
"dense_act_fn": "gelu_new",
|
11 |
+
"dropout_rate": 0.1,
|
12 |
+
"eos_token_id": 1,
|
13 |
+
"feed_forward_proj": "gated-gelu",
|
14 |
+
"initializer_factor": 1.0,
|
15 |
+
"is_encoder_decoder": true,
|
16 |
+
"is_gated_act": true,
|
17 |
+
"layer_norm_epsilon": 1e-06,
|
18 |
+
"model_type": "t5",
|
19 |
+
"num_decoder_layers": 12,
|
20 |
+
"num_heads": 12,
|
21 |
+
"num_layers": 12,
|
22 |
+
"output_past": true,
|
23 |
+
"pad_token_id": 0,
|
24 |
+
"relative_attention_max_distance": 128,
|
25 |
+
"relative_attention_num_buckets": 32,
|
26 |
+
"tie_word_embeddings": false,
|
27 |
+
"torch_dtype": "float32",
|
28 |
+
"transformers_version": "4.30.2",
|
29 |
+
"use_cache": true,
|
30 |
+
"vocab_size": 40043
|
31 |
+
}
|
eval_results.txt
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
eval_loss = 0.03081325274493281
|
generation_config.json
ADDED
@@ -0,0 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"_from_model_config": true,
|
3 |
+
"decoder_start_token_id": 0,
|
4 |
+
"eos_token_id": 1,
|
5 |
+
"pad_token_id": 0,
|
6 |
+
"transformers_version": "4.30.2"
|
7 |
+
}
|
model_args.json
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
{"adafactor_beta1": null, "adafactor_clip_threshold": 1.0, "adafactor_decay_rate": -0.8, "adafactor_eps": [1e-30, 0.001], "adafactor_relative_step": false, "adafactor_scale_parameter": false, "adafactor_warmup_init": false, "adam_epsilon": 1e-08, "best_model_dir": "./outputs/prompt_pretrain_271k_trad_sim/best_model", "cache_dir": "cache_dir/", "config": {}, "cosine_schedule_num_cycles": 0.5, "custom_layer_parameters": [], "custom_parameter_groups": [], "dataloader_num_workers": 0, "do_lower_case": false, "dynamic_quantize": false, "early_stopping_consider_epochs": false, "early_stopping_delta": 0, "early_stopping_metric": "eval_loss", "early_stopping_metric_minimize": true, "early_stopping_patience": 3, "encoding": "utf-8", "eval_batch_size": 8, "evaluate_during_training": true, "evaluate_during_training_silent": true, "evaluate_during_training_steps": 6000, "evaluate_during_training_verbose": true, "evaluate_each_epoch": true, "fp16": false, "gradient_accumulation_steps": 1, "learning_rate": 0.0005, "local_rank": -1, "logging_steps": 50, "manual_seed": null, "max_grad_norm": 1.0, "max_seq_length": 200, "model_name": "./outputs/prompt_1m", "model_type": "t5", "multiprocessing_chunksize": -1, "n_gpu": 1, "no_cache": false, "no_save": false, "not_saved_args": [], "num_train_epochs": 20, "optimizer": "AdamW", "output_dir": "./outputs/prompt_pretrain_271k_trad_sim", "overwrite_output_dir": true, "polynomial_decay_schedule_lr_end": 1e-07, "polynomial_decay_schedule_power": 1.0, "process_count": 46, "quantized_model": false, "reprocess_input_data": true, "save_best_model": true, "save_eval_checkpoints": false, "save_model_every_epoch": true, "save_optimizer_and_scheduler": true, "save_steps": 6000, "scheduler": "constant_schedule_with_warmup", "silent": false, "skip_special_tokens": true, "tensorboard_dir": null, "thread_count": null, "tokenizer_name": null, "tokenizer_type": null, "train_batch_size": 40, "train_custom_parameters_only": false, "use_cached_eval_features": false, "use_early_stopping": true, "use_hf_datasets": false, "use_multiprocessing": false, "use_multiprocessing_for_evaluation": false, "wandb_kwargs": {}, "wandb_project": null, "warmup_ratio": 0.06, "warmup_steps": 17847, "weight_decay": 0.0, "model_class": "T5Model", "dataset_class": null, "do_sample": false, "early_stopping": true, "evaluate_generated_text": true, "length_penalty": 2.0, "max_length": 400, "max_steps": -1, "num_beams": 1, "num_return_sequences": 1, "preprocess_inputs": true, "repetition_penalty": 1.0, "special_tokens_list": [], "top_k": null, "top_p": null, "use_multiprocessed_decoding": false}
|
pytorch_model.bin
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:0375c340cb0a0c0767396cc300501bc0f0ba457b9e86624dcd5d089f79801613
|
3 |
+
size 1039038645
|
special_tokens_map.json
ADDED
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"eos_token": "</s>",
|
3 |
+
"pad_token": "<pad>",
|
4 |
+
"unk_token": "<unk>"
|
5 |
+
}
|
spiece.model
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:5c2083a4dd8b56e99db4a408d68a50d4374252628247dbdc9d5931fddcf0a66d
|
3 |
+
size 742045
|
tokenizer_config.json
ADDED
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"additional_special_tokens": null,
|
3 |
+
"clean_up_tokenization_spaces": true,
|
4 |
+
"eos_token": "</s>",
|
5 |
+
"extra_ids": 0,
|
6 |
+
"model_max_length": 512,
|
7 |
+
"pad_token": "<pad>",
|
8 |
+
"sp_model_kwargs": {},
|
9 |
+
"tokenizer_class": "T5Tokenizer",
|
10 |
+
"truncate": true,
|
11 |
+
"unk_token": "<unk>"
|
12 |
+
}
|
training_args.bin
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:d4004c67f6811d29f97761871e890fea8561fc337cb140ef4994ebebb32edeaf
|
3 |
+
size 3195
|