Update README.md
Browse files
README.md
CHANGED
|
@@ -17,7 +17,7 @@ datasets:
|
|
| 17 |
---
|
| 18 |
|
| 19 |
# Model
|
| 20 |
-
This model utilises T5-base sentence correction pre-trained model. It was fine tuned using a modified version of the [JFLEG](https://arxiv.org/abs/1702.04066) dataset and [Happy Transformer framework](https://github.com/EricFillion/happy-transformer). This model was pre-trained for educational purposes only for correction on local
|
| 21 |
.
|
| 22 |
___
|
| 23 |
|
|
@@ -47,4 +47,24 @@ if(correction.text.find(" .")):
|
|
| 47 |
|
| 48 |
print(correction.text) # Correction: "What is your name?".
|
| 49 |
|
| 50 |
-
```
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 17 |
---
|
| 18 |
|
| 19 |
# Model
|
| 20 |
+
This model utilises T5-base sentence correction pre-trained model. It was fine tuned using a modified version of the [JFLEG](https://arxiv.org/abs/1702.04066) dataset and [Happy Transformer framework](https://github.com/EricFillion/happy-transformer). This model was pre-trained for educational purposes only for correction on local Caribbean dialect. For more on Caribbean dialect checkout the library [Caribe](https://pypi.org/project/Caribe/).
|
| 21 |
.
|
| 22 |
___
|
| 23 |
|
|
|
|
| 47 |
|
| 48 |
print(correction.text) # Correction: "What is your name?".
|
| 49 |
|
| 50 |
+
```
|
| 51 |
+
_
|
| 52 |
+
# Usage with Transformers
|
| 53 |
+
|
| 54 |
+
```python
|
| 55 |
+
|
| 56 |
+
from transformers import AutoTokenizer, AutoModelForSeq2SeqLM
|
| 57 |
+
|
| 58 |
+
tokenizer = AutoTokenizer.from_pretrained("KES/T5-KES")
|
| 59 |
+
|
| 60 |
+
model = AutoModelForSeq2SeqLM.from_pretrained("KES/T5-KES")
|
| 61 |
+
|
| 62 |
+
text = "I am lived with my parenmts "
|
| 63 |
+
inputs = tokenizer("grammar:"+text, truncation=True, return_tensors='pt')
|
| 64 |
+
|
| 65 |
+
output = model.generate(inputs['input_ids'], num_beams=4, max_length=512, early_stopping=True)
|
| 66 |
+
correction=tokenizer.batch_decode(output, skip_special_tokens=True)
|
| 67 |
+
print("".join(correction)) #Correction: I am living with my parents.
|
| 68 |
+
|
| 69 |
+
```
|
| 70 |
+
|