Add error message concerning revision (#13266)

* add error message concerning revision

* Update src/transformers/configuration_utils.py

Co-authored-by: Lysandre Debut <lysandre@huggingface.co>

* re-add double line endings

* is not None instead of implicit bool casting

Co-authored-by: Lysandre Debut <lysandre@huggingface.co>
This commit is contained in:
Bram Vanroy
2021-08-26 10:32:57 +02:00
committed by GitHub
parent 40d60e1536
commit 401377e679
3 changed files with 13 additions and 1 deletions

View File

@@ -1723,6 +1723,10 @@ class PreTrainedTokenizerBase(SpecialTokensMixin, PushToHubMixin):
f"- '{pretrained_model_name_or_path}' is a correct model identifier listed on 'https://huggingface.co/models'\n\n"
f"- or '{pretrained_model_name_or_path}' is the correct path to a directory containing relevant tokenizer files\n\n"
)
if revision is not None:
msg += f"- or '{revision}' is a valid git identifier (branch name, a tag name, or a commit id) that exists for this model name as listed on its model page on 'https://huggingface.co/models'\n\n"
raise EnvironmentError(msg)
for file_id, file_path in vocab_files.items():