ozzwoy commited on
Commit
e22e7c4
·
verified ·
1 Parent(s): e0110fd

Added an example of use

Browse files
Files changed (1) hide show
  1. README.md +18 -0
README.md CHANGED
@@ -5,6 +5,24 @@ license: mit
5
 
6
  The MADLAD-400 model fine-tuned to translate from Proper Karelian, Livvi, Ludian, and Veps to Russian and vice versa. We call this model **Pa**ragraph-**Le**vel as we trained it on paragraphs comprising multiple sentences. The model demonstrates the capacity to handle gender-neutral pronouns (presenting a major obstacle in translating from Finno-Ugric languages) and other discourse-level phenomena.
7
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
8
  Please cite the following paper if you use this model in your work:
9
  ```
10
  @inproceedings{
 
5
 
6
  The MADLAD-400 model fine-tuned to translate from Proper Karelian, Livvi, Ludian, and Veps to Russian and vice versa. We call this model **Pa**ragraph-**Le**vel as we trained it on paragraphs comprising multiple sentences. The model demonstrates the capacity to handle gender-neutral pronouns (presenting a major obstacle in translating from Finno-Ugric languages) and other discourse-level phenomena.
7
 
8
+ ### Example Usage for Inference
9
+
10
+ ````
11
+ from transformers import AutoModelForSeq2SeqLM, AutoTokenizer
12
+
13
+ model = AutoModelForSeq2SeqLM.from_pretrained('tartuNLP/pale-madlad-mt')
14
+ tokenizer = AutoTokenizer.from_pretrained('tartuNLP/pale-madlad-mt')
15
+
16
+ # You need to explicitly prepend a target language tag to the input string in the format <2xx>, where xx stands for the language code.
17
+ # Language codes: 'krl' for Proper Karelian, 'lud' for Ludian, 'olo' for Livvi, 'vep' for Veps, 'ru' for Russian, 'en' for English.
18
+ text = '<2krl>' + 'Здравствуйте!'
19
+
20
+ inputs = tokenizer(text, return_tensors='pt').input_ids
21
+ outputs = model.generate(inputs)
22
+ tokenizer.decode(outputs[0], skip_special_tokens=True)
23
+ # Output: Terveh!
24
+ ````
25
+
26
  Please cite the following paper if you use this model in your work:
27
  ```
28
  @inproceedings{