BlackKakapo
commited on
Commit
•
47df75d
1
Parent(s):
1571c14
Update README.md
Browse files
README.md
CHANGED
@@ -34,4 +34,30 @@ from transformers import AutoTokenizer, AutoModelForSeq2SeqLM
|
|
34 |
|
35 |
tokenizer = AutoTokenizer.from_pretrained("BlackKakapo/t5-small-grammar-ro-root")
|
36 |
model = AutoModelForSeq2SeqLM.from_pretrained("BlackKakapo/t5-small-grammar-ro-root")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
37 |
```
|
|
|
34 |
|
35 |
tokenizer = AutoTokenizer.from_pretrained("BlackKakapo/t5-small-grammar-ro-root")
|
36 |
model = AutoModelForSeq2SeqLM.from_pretrained("BlackKakapo/t5-small-grammar-ro-root")
|
37 |
+
```
|
38 |
+
|
39 |
+
### Or
|
40 |
+
```cmd
|
41 |
+
pip install happytransformer
|
42 |
+
```
|
43 |
+
|
44 |
+
```python
|
45 |
+
from happytransformer import TTSettings, HappyTextToText
|
46 |
+
|
47 |
+
happy_tt_save = HappyTextToText('T5',r"BlackKakapo/t5-small-grammar-ro")
|
48 |
+
beam_settings = TTSettings(num_beams=10, min_length=10, max_length=100)
|
49 |
+
```
|
50 |
+
### Generate
|
51 |
+
```python
|
52 |
+
sent = "As dori ca sa corecteze toate greșelile."
|
53 |
+
prefix = "grammar: "
|
54 |
+
example = prefix + sent
|
55 |
+
|
56 |
+
result = happy_tt_save.generate_text(example, args=beam_settings)
|
57 |
+
|
58 |
+
print(result.text)
|
59 |
+
```
|
60 |
+
### Output
|
61 |
+
```out
|
62 |
+
Aș dori ca să corecteze toate greșelile.
|
63 |
```
|