diff --git a/nemo/collections/nlp/modules/common/tokenizer_utils.py b/nemo/collections/nlp/modules/common/tokenizer_utils.py index 1a7318c4e7ce8..2ce259589bf8b 100644 --- a/nemo/collections/nlp/modules/common/tokenizer_utils.py +++ b/nemo/collections/nlp/modules/common/tokenizer_utils.py @@ -173,7 +173,11 @@ def get_nmt_tokenizer( if (library != 'byte-level') and ( model_name is None and (tokenizer_model is None or not os.path.isfile(tokenizer_model)) ): - raise ValueError("No Tokenizer path provided or file does not exist!") + if tokenizer_model is None: + error_message = "No Tokenizer path provided!" + else: + error_message = f"Tokenizer path ({tokenizer_model}) does not exist!" + raise ValueError(error_message) if library == 'yttm': logging.info(f'Getting YouTokenToMeTokenizer with model: {tokenizer_model} with r2l: {r2l}.')