CodeTed commited on
Commit
826116f
·
1 Parent(s): 38ad601

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +13 -1
README.md CHANGED
@@ -13,4 +13,16 @@ tags:
13
  pipeline_tag: text2text-generation
14
  ---
15
  # CGEDit - Chinese Grammatical Error Diagnosis by Task-Specific Instruction Tuning
16
- ![CGEDit_model.png](https://cdn-uploads.huggingface.co/production/uploads/64c7473f513a7fa7c32e153b/AtlsZUWz86rKyb_9EWlDa.png)
 
 
 
 
 
 
 
 
 
 
 
 
 
13
  pipeline_tag: text2text-generation
14
  ---
15
  # CGEDit - Chinese Grammatical Error Diagnosis by Task-Specific Instruction Tuning
16
+ ![CGEDit_model.png](https://cdn-uploads.huggingface.co/production/uploads/64c7473f513a7fa7c32e153b/AtlsZUWz86rKyb_9EWlDa.png)
17
+
18
+ ## Usage
19
+ ```python
20
+ from transformers import AutoTokenizer, T5ForConditionalGeneration
21
+
22
+ tokenizer = AutoTokenizer.from_pretrained("CodeTed/CGEDit")
23
+ model = T5ForConditionalGeneration.from_pretrained("CodeTed/CGEDit")
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
+ ```