Added Demo Code
#2
by
Akash123
- opened
README.md
CHANGED
@@ -17,6 +17,24 @@ Based on the "google/mt5-small" pre-trained model. Fine-tuned it on Hindi to Eng
|
|
17 |
- number of batches = int(np.ceil(len(dataset) / batch size))
|
18 |
- n_warmup_steps = int(number of epochs * number of batches * 0.01)
|
19 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
20 |
### Training Loss
|
21 |
|
22 |

|
|
|
17 |
- number of batches = int(np.ceil(len(dataset) / batch size))
|
18 |
- n_warmup_steps = int(number of epochs * number of batches * 0.01)
|
19 |
|
20 |
+
### How to Get Started with the Model
|
21 |
+
|
22 |
+
Use the code below to get started with the model.
|
23 |
+
|
24 |
+
```python
|
25 |
+
from transformers import AutoTokenizer, AutoModelForSeq2SeqLM
|
26 |
+
|
27 |
+
tokenizer = AutoTokenizer.from_pretrained("snehalyelmati/mt5-hindi-to-english")
|
28 |
+
model = AutoModelForSeq2SeqLM.from_pretrained("snehalyelmati/mt5-hindi-to-english")
|
29 |
+
|
30 |
+
input_text = ""
|
31 |
+
tokenized_text = tokenizer(input_text,return_tensors="pt")
|
32 |
+
translated = model.generate(**tokenized_text)
|
33 |
+
translated_text = tokenizer.batch_decode(translated, skip_special_tokens=True)[0]
|
34 |
+
print(translated_text)
|
35 |
+
```
|
36 |
+
|
37 |
+
|
38 |
### Training Loss
|
39 |
|
40 |

|