File size: 1,071 Bytes
b75bc6a
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
---
license: apache-2.0
language:
- en
- pt
- es
- de
- it
library_name: transformers
tags:
- text-generation-inference
---

T5ForConditionalGeneration files for the [Madlad-400](https://github.com/google-research/google-research/tree/master/madlad_400) 3B parameter MT model.


```python
from transformers import T5ForConditionalGeneration, T5Tokenizer, GenerationConfig
model = T5ForConditionalGeneration.from_pretrained("iliemihai/madlad400-3b-mt")
tokenizer = T5Tokenizer.from_pretrained("iliemihai/madlad400-3b-mt")

text = """The quick brown fox jumped over the laisy dog."""
input_ids = tokenizer.encode(f"<2ro> {text} </s>", return_tensors="pt")
outputs = model.generate(input_ids, 
        do_sample=True,
        early_stopping=True,
        top_p=0.92,
        top_k=50,
        temperature=0.3,
        max_length=256)
print(tokenizer.decode(outputs[0]))
```

**KUDOS TO jbochi FOR RELEASING THE COLAB AND CONVERSION CODE
Colab to generate these files is [here](https://colab.research.google.com/drive/1rZ2NRyl2zwmg0sQ2Wi-uZZF48iVYulTC#scrollTo=pVODoE6gA9sw).