Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
chenpangpang
transformers
Commits
8415a38b
Commit
8415a38b
authored
Jun 17, 2019
by
thomwolf
Browse files
better error messages
parent
96c4d3d9
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
100 additions
and
60 deletions
+100
-60
pytorch_pretrained_bert/modeling.py
pytorch_pretrained_bert/modeling.py
+12
-7
pytorch_pretrained_bert/modeling_gpt2.py
pytorch_pretrained_bert/modeling_gpt2.py
+12
-7
pytorch_pretrained_bert/modeling_openai.py
pytorch_pretrained_bert/modeling_openai.py
+12
-7
pytorch_pretrained_bert/modeling_transfo_xl.py
pytorch_pretrained_bert/modeling_transfo_xl.py
+13
-8
pytorch_pretrained_bert/tokenization.py
pytorch_pretrained_bert/tokenization.py
+12
-7
pytorch_pretrained_bert/tokenization_gpt2.py
pytorch_pretrained_bert/tokenization_gpt2.py
+13
-8
pytorch_pretrained_bert/tokenization_openai.py
pytorch_pretrained_bert/tokenization_openai.py
+13
-8
pytorch_pretrained_bert/tokenization_transfo_xl.py
pytorch_pretrained_bert/tokenization_transfo_xl.py
+13
-8
No files found.
pytorch_pretrained_bert/modeling.py
View file @
8415a38b
...
@@ -646,13 +646,18 @@ class BertPreTrainedModel(nn.Module):
...
@@ -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
))
...
...
pytorch_pretrained_bert/modeling_gpt2.py
View file @
8415a38b
...
@@ -446,14 +446,19 @@ class GPT2PreTrainedModel(nn.Module):
...
@@ -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
))
...
...
pytorch_pretrained_bert/modeling_openai.py
View file @
8415a38b
...
@@ -472,14 +472,19 @@ class OpenAIGPTPreTrainedModel(nn.Module):
...
@@ -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
))
...
...
pytorch_pretrained_bert/modeling_transfo_xl.py
View file @
8415a38b
...
@@ -926,14 +926,19 @@ class TransfoXLPreTrainedModel(nn.Module):
...
@@ -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
))
...
...
pytorch_pretrained_bert/tokenization.py
View file @
8415a38b
...
@@ -181,13 +181,18 @@ class BertTokenizer(object):
...
@@ -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
))
...
...
pytorch_pretrained_bert/tokenization_gpt2.py
View file @
8415a38b
...
@@ -113,14 +113,19 @@ class GPT2Tokenizer(object):
...
@@ -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
))
...
...
pytorch_pretrained_bert/tokenization_openai.py
View file @
8415a38b
...
@@ -101,14 +101,19 @@ class OpenAIGPTTokenizer(object):
...
@@ -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
))
...
...
pytorch_pretrained_bert/tokenization_transfo_xl.py
View file @
8415a38b
...
@@ -71,14 +71,19 @@ class TransfoXLTokenizer(object):
...
@@ -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
))
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment