Spaces:
Running
Running
Update src/Translate.py
Browse files- 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("
|
| 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 |
-
|
|
|
|
|
|
|
| 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,
|