Skip to content

Commit

Permalink
Update from reviewer comments
Browse files Browse the repository at this point in the history
  • Loading branch information
johnml1135 committed Nov 21, 2023
1 parent 7f7d8e9 commit cf60661
Showing 1 changed file with 2 additions and 8 deletions.
10 changes: 2 additions & 8 deletions machine/translation/huggingface/hugging_face_nmt_engine.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,20 +47,14 @@ def __init__(
and src_lang not in cast(Any, self._tokenizer).lang_code_to_id
and src_lang not in additional_special_tokens
):
raise ValueError(
f"'{src_lang}' is not a valid language code. This error can happen when "
+ "there is no matching training data and the language code is not in the NLLB-200."
)
raise ValueError(f"The specified model does not support the language code '{src_lang}'")

if (
tgt_lang is not None
and tgt_lang not in cast(Any, self._tokenizer).lang_code_to_id
and tgt_lang not in additional_special_tokens
):
raise ValueError(
f"'{tgt_lang}' is not a valid language code. This error can happen when "
+ "there is no matching training data and the language code is not in the NLLB-200."
)
raise ValueError(f"The specified model does not support the language code '{src_lang}'")

self._pipeline = _TranslationPipeline(
model=model,
Expand Down

0 comments on commit cf60661

Please sign in to comment.