issam9 commited on
Commit
d9eaede
1 Parent(s): 8f5b110

Create README.md

Browse files
Files changed (1) hide show
  1. README.md +33 -0
README.md ADDED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # NLLB-600M Finetuned for Robustness
2
+ We finetuned NLLB-200-distilled-600M using adapters for robustness to ASR and synthetic non-native speakers noise.
3
+
4
+ ## How to use
5
+
6
+ Start by installing transformers with NLLB-200 model with added adapters
7
+ ```bash
8
+ git clone https://gitlab.com/horizon-europe-voxreality/multilingual-translation/speech-translation-demo.git
9
+ cd speech-translation-demo
10
+ # You might need to switch to dev branch
11
+ pip install -e transformers
12
+ ```
13
+ And now we can use the model:
14
+ ```python
15
+
16
+ model_name = 'voxreality/nllb-asr-synthetic-robust'
17
+ tokenizer = AutoTokenizer.from_pretrained(model_name)
18
+ model = M2M100ForConditionalGenerationWithAdapters.from_pretrained(model_name)
19
+
20
+ src_lang = 'eng_Latn'
21
+ tgt_lang = 'deu_Latn'
22
+
23
+ input_text = "This is a good day"
24
+
25
+ tokenizer.src_lang = src_lang
26
+ inputs = tokenizer(input_text, return_tensors='pt').to(model.device)
27
+ model_output = model.generate(**inputs,
28
+ forced_bos_token_id=tokenizer.lang_code_to_id[tgt_lang])
29
+ output_text = tokenizer.batch_decode(model_output, skip_special_tokens=True)[0]
30
+
31
+ print(output_text)
32
+
33
+ ```