Update README.md
Browse files
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 |
-

|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 13 |
pipeline_tag: text2text-generation
|
| 14 |
---
|
| 15 |
# CGEDit - Chinese Grammatical Error Diagnosis by Task-Specific Instruction Tuning
|
| 16 |
+

|
| 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 |
+
```
|