Improved Error message when loading config/model with .from_pretrained() (#3247)

* better error message

* better error message

* update to model identifier instead of url

* update to model identifier instead of ur
This commit is contained in:
Patrick von Platen 2020-03-16 09:48:30 +01:00 committed by GitHub
parent 5ea8ba67b4
commit af471ce5e8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 11 additions and 4 deletions

View File

@ -250,10 +250,17 @@ class PretrainedConfig(object):
) )
else: else:
msg = ( msg = (
"Model name '{}' was not found in model name list. " "Can't load '{}'. Make sure that:\n\n"
"We assumed '{}' was a path, a model identifier, or url to a configuration file named {} or " "- '{}' is either a correct model identifier of a community model from 'https://huggingface.co/models' which has a '{}' file\n\n"
"a directory containing such a file but couldn't find any such file at this path or url.".format( "- or '{}' is a model name in {}\n\n"
pretrained_model_name_or_path, config_file, CONFIG_NAME, "- or '{}' is the correct path to a directory containing a '{}' file".format(
pretrained_model_name_or_path,
pretrained_model_name_or_path,
CONFIG_NAME,
pretrained_model_name_or_path,
list(pretrained_config_archive_map.keys()),
pretrained_model_name_or_path,
CONFIG_NAME,
) )
) )
raise EnvironmentError(msg) raise EnvironmentError(msg)