Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
chenpangpang
transformers
Commits
3f20dd71
Unverified
Commit
3f20dd71
authored
Aug 23, 2019
by
Thomas Wolf
Committed by
GitHub
Aug 23, 2019
Browse files
Merge pull request #1075 from abhishekraok/modeling_utils_config_None
reraise EnvironmentError in modeling_utils.py
parents
e00b4ff1
c603d099
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
6 additions
and
6 deletions
+6
-6
pytorch_transformers/modeling_utils.py
pytorch_transformers/modeling_utils.py
+4
-4
pytorch_transformers/tokenization_utils.py
pytorch_transformers/tokenization_utils.py
+2
-2
No files found.
pytorch_transformers/modeling_utils.py
View file @
3f20dd71
...
@@ -166,7 +166,7 @@ class PretrainedConfig(object):
...
@@ -166,7 +166,7 @@ class PretrainedConfig(object):
# redirect to the cache, if necessary
# redirect to the cache, if necessary
try
:
try
:
resolved_config_file
=
cached_path
(
config_file
,
cache_dir
=
cache_dir
,
force_download
=
force_download
,
proxies
=
proxies
)
resolved_config_file
=
cached_path
(
config_file
,
cache_dir
=
cache_dir
,
force_download
=
force_download
,
proxies
=
proxies
)
except
EnvironmentError
:
except
EnvironmentError
as
e
:
if
pretrained_model_name_or_path
in
cls
.
pretrained_config_archive_map
:
if
pretrained_model_name_or_path
in
cls
.
pretrained_config_archive_map
:
logger
.
error
(
logger
.
error
(
"Couldn't reach server at '{}' to download pretrained model configuration file."
.
format
(
"Couldn't reach server at '{}' to download pretrained model configuration file."
.
format
(
...
@@ -179,7 +179,7 @@ class PretrainedConfig(object):
...
@@ -179,7 +179,7 @@ class PretrainedConfig(object):
pretrained_model_name_or_path
,
pretrained_model_name_or_path
,
', '
.
join
(
cls
.
pretrained_config_archive_map
.
keys
()),
', '
.
join
(
cls
.
pretrained_config_archive_map
.
keys
()),
config_file
))
config_file
))
r
eturn
Non
e
r
aise
e
if
resolved_config_file
==
config_file
:
if
resolved_config_file
==
config_file
:
logger
.
info
(
"loading configuration file {}"
.
format
(
config_file
))
logger
.
info
(
"loading configuration file {}"
.
format
(
config_file
))
else
:
else
:
...
@@ -473,7 +473,7 @@ class PreTrainedModel(nn.Module):
...
@@ -473,7 +473,7 @@ class PreTrainedModel(nn.Module):
# redirect to the cache, if necessary
# redirect to the cache, if necessary
try
:
try
:
resolved_archive_file
=
cached_path
(
archive_file
,
cache_dir
=
cache_dir
,
force_download
=
force_download
,
proxies
=
proxies
)
resolved_archive_file
=
cached_path
(
archive_file
,
cache_dir
=
cache_dir
,
force_download
=
force_download
,
proxies
=
proxies
)
except
EnvironmentError
:
except
EnvironmentError
as
e
:
if
pretrained_model_name_or_path
in
cls
.
pretrained_model_archive_map
:
if
pretrained_model_name_or_path
in
cls
.
pretrained_model_archive_map
:
logger
.
error
(
logger
.
error
(
"Couldn't reach server at '{}' to download pretrained weights."
.
format
(
"Couldn't reach server at '{}' to download pretrained weights."
.
format
(
...
@@ -486,7 +486,7 @@ class PreTrainedModel(nn.Module):
...
@@ -486,7 +486,7 @@ class PreTrainedModel(nn.Module):
pretrained_model_name_or_path
,
pretrained_model_name_or_path
,
', '
.
join
(
cls
.
pretrained_model_archive_map
.
keys
()),
', '
.
join
(
cls
.
pretrained_model_archive_map
.
keys
()),
archive_file
))
archive_file
))
r
eturn
Non
e
r
aise
e
if
resolved_archive_file
==
archive_file
:
if
resolved_archive_file
==
archive_file
:
logger
.
info
(
"loading weights file {}"
.
format
(
archive_file
))
logger
.
info
(
"loading weights file {}"
.
format
(
archive_file
))
else
:
else
:
...
...
pytorch_transformers/tokenization_utils.py
View file @
3f20dd71
...
@@ -293,7 +293,7 @@ class PreTrainedTokenizer(object):
...
@@ -293,7 +293,7 @@ class PreTrainedTokenizer(object):
resolved_vocab_files
[
file_id
]
=
None
resolved_vocab_files
[
file_id
]
=
None
else
:
else
:
resolved_vocab_files
[
file_id
]
=
cached_path
(
file_path
,
cache_dir
=
cache_dir
,
force_download
=
force_download
,
proxies
=
proxies
)
resolved_vocab_files
[
file_id
]
=
cached_path
(
file_path
,
cache_dir
=
cache_dir
,
force_download
=
force_download
,
proxies
=
proxies
)
except
EnvironmentError
:
except
EnvironmentError
as
e
:
if
pretrained_model_name_or_path
in
s3_models
:
if
pretrained_model_name_or_path
in
s3_models
:
logger
.
error
(
"Couldn't reach server to download vocabulary."
)
logger
.
error
(
"Couldn't reach server to download vocabulary."
)
else
:
else
:
...
@@ -303,7 +303,7 @@ class PreTrainedTokenizer(object):
...
@@ -303,7 +303,7 @@ class PreTrainedTokenizer(object):
"at this path or url."
.
format
(
"at this path or url."
.
format
(
pretrained_model_name_or_path
,
', '
.
join
(
s3_models
),
pretrained_model_name_or_path
,
', '
.
join
(
s3_models
),
pretrained_model_name_or_path
,
str
(
vocab_files
.
keys
())))
pretrained_model_name_or_path
,
str
(
vocab_files
.
keys
())))
r
eturn
Non
e
r
aise
e
for
file_id
,
file_path
in
vocab_files
.
items
():
for
file_id
,
file_path
in
vocab_files
.
items
():
if
file_path
==
resolved_vocab_files
[
file_id
]:
if
file_path
==
resolved_vocab_files
[
file_id
]:
...
...
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