Spaces:
Running
Running
Update src/Translate.py
Browse files- src/Translate.py +3 -3
src/Translate.py
CHANGED
|
@@ -66,8 +66,8 @@ class Translators:
|
|
| 66 |
model_name = "facebook/mbart-large-cc25"
|
| 67 |
|
| 68 |
# load tokenizer and model
|
| 69 |
-
tokenizer = AutoTokenizer.from_pretrained(model_name)
|
| 70 |
-
model = AutoModelForSeq2SeqLM.from_pretrained(model_name)
|
| 71 |
|
| 72 |
# tell tokenizer the source language
|
| 73 |
# tokenizer.src_lang = "en_XX"
|
|
@@ -79,7 +79,7 @@ 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=
|
| 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
|
|
|
|
| 66 |
model_name = "facebook/mbart-large-cc25"
|
| 67 |
|
| 68 |
# load tokenizer and model
|
| 69 |
+
# tokenizer = AutoTokenizer.from_pretrained(model_name)
|
| 70 |
+
# model = AutoModelForSeq2SeqLM.from_pretrained(model_name)
|
| 71 |
|
| 72 |
# tell tokenizer the source language
|
| 73 |
# tokenizer.src_lang = "en_XX"
|
|
|
|
| 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
|