better error messages
This commit is contained in:
@@ -646,13 +646,18 @@ class BertPreTrainedModel(nn.Module):
|
|||||||
try:
|
try:
|
||||||
resolved_archive_file = cached_path(archive_file, cache_dir=cache_dir)
|
resolved_archive_file = cached_path(archive_file, cache_dir=cache_dir)
|
||||||
except EnvironmentError:
|
except EnvironmentError:
|
||||||
logger.error(
|
if pretrained_model_name_or_path in PRETRAINED_MODEL_ARCHIVE_MAP:
|
||||||
"Model name '{}' was not found in model name list ({}). "
|
logger.error(
|
||||||
"We assumed '{}' was a path or url but couldn't find any file "
|
"Couldn't reach server at '{}' to download pretrained weights.".format(
|
||||||
"associated to this path or url.".format(
|
archive_file))
|
||||||
pretrained_model_name_or_path,
|
else:
|
||||||
', '.join(PRETRAINED_MODEL_ARCHIVE_MAP.keys()),
|
logger.error(
|
||||||
archive_file))
|
"Model name '{}' was not found in model name list ({}). "
|
||||||
|
"We assumed '{}' was a path or url but couldn't find any file "
|
||||||
|
"associated to this path or url.".format(
|
||||||
|
pretrained_model_name_or_path,
|
||||||
|
', '.join(PRETRAINED_MODEL_ARCHIVE_MAP.keys()),
|
||||||
|
archive_file))
|
||||||
return None
|
return None
|
||||||
if resolved_archive_file == archive_file:
|
if resolved_archive_file == archive_file:
|
||||||
logger.info("loading archive file {}".format(archive_file))
|
logger.info("loading archive file {}".format(archive_file))
|
||||||
|
|||||||
@@ -446,14 +446,19 @@ class GPT2PreTrainedModel(nn.Module):
|
|||||||
resolved_archive_file = cached_path(archive_file, cache_dir=cache_dir)
|
resolved_archive_file = cached_path(archive_file, cache_dir=cache_dir)
|
||||||
resolved_config_file = cached_path(config_file, cache_dir=cache_dir)
|
resolved_config_file = cached_path(config_file, cache_dir=cache_dir)
|
||||||
except EnvironmentError:
|
except EnvironmentError:
|
||||||
logger.error(
|
if pretrained_model_name_or_path in PRETRAINED_MODEL_ARCHIVE_MAP:
|
||||||
"Model name '{}' was not found in model name list ({}). "
|
logger.error(
|
||||||
"We assumed '{}' was a path or url but couldn't find files {} and {} "
|
"Couldn't reach server at '{}' to download pretrained weights.".format(
|
||||||
"at this path or url.".format(
|
archive_file))
|
||||||
pretrained_model_name_or_path, ", ".join(PRETRAINED_MODEL_ARCHIVE_MAP.keys()), pretrained_model_name_or_path,
|
else:
|
||||||
archive_file, config_file
|
logger.error(
|
||||||
|
"Model name '{}' was not found in model name list ({}). "
|
||||||
|
"We assumed '{}' was a path or url but couldn't find files {} and {} "
|
||||||
|
"at this path or url.".format(
|
||||||
|
pretrained_model_name_or_path, ", ".join(PRETRAINED_MODEL_ARCHIVE_MAP.keys()), pretrained_model_name_or_path,
|
||||||
|
archive_file, config_file
|
||||||
|
)
|
||||||
)
|
)
|
||||||
)
|
|
||||||
return None
|
return None
|
||||||
if resolved_archive_file == archive_file and resolved_config_file == config_file:
|
if resolved_archive_file == archive_file and resolved_config_file == config_file:
|
||||||
logger.info("loading weights file {}".format(archive_file))
|
logger.info("loading weights file {}".format(archive_file))
|
||||||
|
|||||||
@@ -472,14 +472,19 @@ class OpenAIGPTPreTrainedModel(nn.Module):
|
|||||||
resolved_archive_file = cached_path(archive_file, cache_dir=cache_dir)
|
resolved_archive_file = cached_path(archive_file, cache_dir=cache_dir)
|
||||||
resolved_config_file = cached_path(config_file, cache_dir=cache_dir)
|
resolved_config_file = cached_path(config_file, cache_dir=cache_dir)
|
||||||
except EnvironmentError:
|
except EnvironmentError:
|
||||||
logger.error(
|
if pretrained_model_name_or_path in PRETRAINED_MODEL_ARCHIVE_MAP:
|
||||||
"Model name '{}' was not found in model name list ({}). "
|
logger.error(
|
||||||
"We assumed '{}' was a path or url but couldn't find files {} and {} "
|
"Couldn't reach server at '{}' to download pretrained weights.".format(
|
||||||
"at this path or url.".format(
|
archive_file))
|
||||||
pretrained_model_name_or_path, ", ".join(PRETRAINED_MODEL_ARCHIVE_MAP.keys()), pretrained_model_name_or_path,
|
else:
|
||||||
archive_file, config_file
|
logger.error(
|
||||||
|
"Model name '{}' was not found in model name list ({}). "
|
||||||
|
"We assumed '{}' was a path or url but couldn't find files {} and {} "
|
||||||
|
"at this path or url.".format(
|
||||||
|
pretrained_model_name_or_path, ", ".join(PRETRAINED_MODEL_ARCHIVE_MAP.keys()), pretrained_model_name_or_path,
|
||||||
|
archive_file, config_file
|
||||||
|
)
|
||||||
)
|
)
|
||||||
)
|
|
||||||
return None
|
return None
|
||||||
if resolved_archive_file == archive_file and resolved_config_file == config_file:
|
if resolved_archive_file == archive_file and resolved_config_file == config_file:
|
||||||
logger.info("loading weights file {}".format(archive_file))
|
logger.info("loading weights file {}".format(archive_file))
|
||||||
|
|||||||
@@ -926,14 +926,19 @@ class TransfoXLPreTrainedModel(nn.Module):
|
|||||||
resolved_archive_file = cached_path(archive_file, cache_dir=cache_dir)
|
resolved_archive_file = cached_path(archive_file, cache_dir=cache_dir)
|
||||||
resolved_config_file = cached_path(config_file, cache_dir=cache_dir)
|
resolved_config_file = cached_path(config_file, cache_dir=cache_dir)
|
||||||
except EnvironmentError:
|
except EnvironmentError:
|
||||||
logger.error(
|
if pretrained_model_name_or_path in PRETRAINED_MODEL_ARCHIVE_MAP:
|
||||||
"Model name '{}' was not found in model name list ({}). "
|
logger.error(
|
||||||
"We assumed '{}' was a path or url but couldn't find files {} and {} "
|
"Couldn't reach server at '{}' to download pretrained weights.".format(
|
||||||
"at this path or url.".format(
|
archive_file))
|
||||||
pretrained_model_name_or_path,
|
else:
|
||||||
', '.join(PRETRAINED_MODEL_ARCHIVE_MAP.keys()),
|
logger.error(
|
||||||
pretrained_model_name_or_path,
|
"Model name '{}' was not found in model name list ({}). "
|
||||||
archive_file, config_file))
|
"We assumed '{}' was a path or url but couldn't find files {} and {} "
|
||||||
|
"at this path or url.".format(
|
||||||
|
pretrained_model_name_or_path,
|
||||||
|
', '.join(PRETRAINED_MODEL_ARCHIVE_MAP.keys()),
|
||||||
|
pretrained_model_name_or_path,
|
||||||
|
archive_file, config_file))
|
||||||
return None
|
return None
|
||||||
if resolved_archive_file == archive_file and resolved_config_file == config_file:
|
if resolved_archive_file == archive_file and resolved_config_file == config_file:
|
||||||
logger.info("loading weights file {}".format(archive_file))
|
logger.info("loading weights file {}".format(archive_file))
|
||||||
|
|||||||
@@ -181,13 +181,18 @@ class BertTokenizer(object):
|
|||||||
try:
|
try:
|
||||||
resolved_vocab_file = cached_path(vocab_file, cache_dir=cache_dir)
|
resolved_vocab_file = cached_path(vocab_file, cache_dir=cache_dir)
|
||||||
except EnvironmentError:
|
except EnvironmentError:
|
||||||
logger.error(
|
if pretrained_model_name_or_path in PRETRAINED_VOCAB_ARCHIVE_MAP:
|
||||||
"Model name '{}' was not found in model name list ({}). "
|
logger.error(
|
||||||
"We assumed '{}' was a path or url but couldn't find any file "
|
"Couldn't reach server at '{}' to download vocabulary.".format(
|
||||||
"associated to this path or url.".format(
|
vocab_file))
|
||||||
pretrained_model_name_or_path,
|
else:
|
||||||
', '.join(PRETRAINED_VOCAB_ARCHIVE_MAP.keys()),
|
logger.error(
|
||||||
vocab_file))
|
"Model name '{}' was not found in model name list ({}). "
|
||||||
|
"We assumed '{}' was a path or url but couldn't find any file "
|
||||||
|
"associated to this path or url.".format(
|
||||||
|
pretrained_model_name_or_path,
|
||||||
|
', '.join(PRETRAINED_VOCAB_ARCHIVE_MAP.keys()),
|
||||||
|
vocab_file))
|
||||||
return None
|
return None
|
||||||
if resolved_vocab_file == vocab_file:
|
if resolved_vocab_file == vocab_file:
|
||||||
logger.info("loading vocabulary file {}".format(vocab_file))
|
logger.info("loading vocabulary file {}".format(vocab_file))
|
||||||
|
|||||||
@@ -113,14 +113,19 @@ class GPT2Tokenizer(object):
|
|||||||
resolved_vocab_file = cached_path(vocab_file, cache_dir=cache_dir)
|
resolved_vocab_file = cached_path(vocab_file, cache_dir=cache_dir)
|
||||||
resolved_merges_file = cached_path(merges_file, cache_dir=cache_dir)
|
resolved_merges_file = cached_path(merges_file, cache_dir=cache_dir)
|
||||||
except EnvironmentError:
|
except EnvironmentError:
|
||||||
logger.error(
|
if pretrained_model_name_or_path in PRETRAINED_VOCAB_ARCHIVE_MAP:
|
||||||
"Model name '{}' was not found in model name list ({}). "
|
logger.error(
|
||||||
"We assumed '{}' was a path or url but couldn't find files {} and {} "
|
"Couldn't reach server at '{}' to download vocabulary.".format(
|
||||||
"at this path or url.".format(
|
vocab_file))
|
||||||
pretrained_model_name_or_path,
|
else:
|
||||||
', '.join(PRETRAINED_VOCAB_ARCHIVE_MAP.keys()),
|
logger.error(
|
||||||
pretrained_model_name_or_path,
|
"Model name '{}' was not found in model name list ({}). "
|
||||||
vocab_file, merges_file))
|
"We assumed '{}' was a path or url but couldn't find files {} and {} "
|
||||||
|
"at this path or url.".format(
|
||||||
|
pretrained_model_name_or_path,
|
||||||
|
', '.join(PRETRAINED_VOCAB_ARCHIVE_MAP.keys()),
|
||||||
|
pretrained_model_name_or_path,
|
||||||
|
vocab_file, merges_file))
|
||||||
return None
|
return None
|
||||||
if resolved_vocab_file == vocab_file and resolved_merges_file == merges_file:
|
if resolved_vocab_file == vocab_file and resolved_merges_file == merges_file:
|
||||||
logger.info("loading vocabulary file {}".format(vocab_file))
|
logger.info("loading vocabulary file {}".format(vocab_file))
|
||||||
|
|||||||
@@ -101,14 +101,19 @@ class OpenAIGPTTokenizer(object):
|
|||||||
resolved_vocab_file = cached_path(vocab_file, cache_dir=cache_dir)
|
resolved_vocab_file = cached_path(vocab_file, cache_dir=cache_dir)
|
||||||
resolved_merges_file = cached_path(merges_file, cache_dir=cache_dir)
|
resolved_merges_file = cached_path(merges_file, cache_dir=cache_dir)
|
||||||
except EnvironmentError:
|
except EnvironmentError:
|
||||||
logger.error(
|
if pretrained_model_name_or_path in PRETRAINED_VOCAB_ARCHIVE_MAP:
|
||||||
"Model name '{}' was not found in model name list ({}). "
|
logger.error(
|
||||||
"We assumed '{}' was a path or url but couldn't find files {} and {} "
|
"Couldn't reach server at '{}' to download vocabulary.".format(
|
||||||
"at this path or url.".format(
|
vocab_file))
|
||||||
pretrained_model_name_or_path,
|
else:
|
||||||
', '.join(PRETRAINED_VOCAB_ARCHIVE_MAP.keys()),
|
logger.error(
|
||||||
pretrained_model_name_or_path,
|
"Model name '{}' was not found in model name list ({}). "
|
||||||
vocab_file, merges_file))
|
"We assumed '{}' was a path or url but couldn't find files {} and {} "
|
||||||
|
"at this path or url.".format(
|
||||||
|
pretrained_model_name_or_path,
|
||||||
|
', '.join(PRETRAINED_VOCAB_ARCHIVE_MAP.keys()),
|
||||||
|
pretrained_model_name_or_path,
|
||||||
|
vocab_file, merges_file))
|
||||||
return None
|
return None
|
||||||
if resolved_vocab_file == vocab_file and resolved_merges_file == merges_file:
|
if resolved_vocab_file == vocab_file and resolved_merges_file == merges_file:
|
||||||
logger.info("loading vocabulary file {}".format(vocab_file))
|
logger.info("loading vocabulary file {}".format(vocab_file))
|
||||||
|
|||||||
@@ -71,14 +71,19 @@ class TransfoXLTokenizer(object):
|
|||||||
try:
|
try:
|
||||||
resolved_vocab_file = cached_path(vocab_file, cache_dir=cache_dir)
|
resolved_vocab_file = cached_path(vocab_file, cache_dir=cache_dir)
|
||||||
except EnvironmentError:
|
except EnvironmentError:
|
||||||
logger.error(
|
if pretrained_model_name_or_path in PRETRAINED_VOCAB_ARCHIVE_MAP:
|
||||||
"Model name '{}' was not found in model name list ({}). "
|
logger.error(
|
||||||
"We assumed '{}' was a path or url but couldn't find files {} "
|
"Couldn't reach server at '{}' to download vocabulary.".format(
|
||||||
"at this path or url.".format(
|
vocab_file))
|
||||||
pretrained_model_name_or_path,
|
else:
|
||||||
', '.join(PRETRAINED_VOCAB_ARCHIVE_MAP.keys()),
|
logger.error(
|
||||||
pretrained_model_name_or_path,
|
"Model name '{}' was not found in model name list ({}). "
|
||||||
vocab_file))
|
"We assumed '{}' was a path or url but couldn't find files {} "
|
||||||
|
"at this path or url.".format(
|
||||||
|
pretrained_model_name_or_path,
|
||||||
|
', '.join(PRETRAINED_VOCAB_ARCHIVE_MAP.keys()),
|
||||||
|
pretrained_model_name_or_path,
|
||||||
|
vocab_file))
|
||||||
return None
|
return None
|
||||||
if resolved_vocab_file == vocab_file:
|
if resolved_vocab_file == vocab_file:
|
||||||
logger.info("loading vocabulary file {}".format(vocab_file))
|
logger.info("loading vocabulary file {}".format(vocab_file))
|
||||||
|
|||||||
Reference in New Issue
Block a user