TiberiuCristianLeon commited on
Commit
704fcda
·
verified ·
1 Parent(s): 842fd9e

Update src/Translate.py

Browse files
Files changed (1) hide show
  1. src/Translate.py +4 -2
src/Translate.py CHANGED
@@ -79,11 +79,13 @@ class Translators:
79
  # forced_bos_token_id = tokenizer.lang_code_to_id["ro_RO"]
80
 
81
  # create the pipeline (pass tokenizer and model explicitly)
82
- pipe = pipeline("translation_en_to_ro", model=model_name)
83
  # "translation" task was used, instead of "translation_XX_to_YY", defaulting to "translation_en_to_ro"
84
 
85
  # call the pipeline; generation kwargs are forwarded to model.generate
86
- src_text = "Check general exterior condition."
 
 
87
  result = pipe(
88
  src_text,
89
  num_beams=4,
 
79
  # forced_bos_token_id = tokenizer.lang_code_to_id["ro_RO"]
80
 
81
  # create the pipeline (pass tokenizer and model explicitly)
82
+ pipe = pipeline("translation", model=model_name, src_lang="en_XX", tgt_lang="ro_RO")
83
  # "translation" task was used, instead of "translation_XX_to_YY", defaulting to "translation_en_to_ro"
84
 
85
  # call the pipeline; generation kwargs are forwarded to model.generate
86
+ # src_lang (str, optional) The language of the input.
87
+ # tgt_lang (str, optional) — The language of the desired output. Might be required for multilingual models. Will not have any effect for single pair translation models
88
+ src_text = "Check general exterior condition"
89
  result = pipe(
90
  src_text,
91
  num_beams=4,