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
63ae5d21
"src/git@developer.sourcefind.cn:gaoqiong/migraphx.git" did not exist on "b691abdd04d510b7c5f1d59190cec9a895e733aa"
Commit
63ae5d21
authored
Nov 26, 2018
by
thomwolf
Browse files
added cache_dir option in from_pretrained
parent
029bdc0d
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
2 additions
and
2 deletions
+2
-2
pytorch_pretrained_bert/modeling.py
pytorch_pretrained_bert/modeling.py
+2
-2
No files found.
pytorch_pretrained_bert/modeling.py
View file @
63ae5d21
...
@@ -443,7 +443,7 @@ class PreTrainedBertModel(nn.Module):
...
@@ -443,7 +443,7 @@ class PreTrainedBertModel(nn.Module):
module
.
bias
.
data
.
zero_
()
module
.
bias
.
data
.
zero_
()
@
classmethod
@
classmethod
def
from_pretrained
(
cls
,
pretrained_model_name
,
*
inputs
,
**
kwargs
):
def
from_pretrained
(
cls
,
pretrained_model_name
,
cache_dir
=
None
,
*
inputs
,
**
kwargs
):
"""
"""
Instantiate a PreTrainedBertModel from a pre-trained model file.
Instantiate a PreTrainedBertModel from a pre-trained model file.
Download and cache the pre-trained model file if needed.
Download and cache the pre-trained model file if needed.
...
@@ -468,7 +468,7 @@ class PreTrainedBertModel(nn.Module):
...
@@ -468,7 +468,7 @@ class PreTrainedBertModel(nn.Module):
archive_file
=
pretrained_model_name
archive_file
=
pretrained_model_name
# redirect to the cache, if necessary
# redirect to the cache, if necessary
try
:
try
:
resolved_archive_file
=
cached_path
(
archive_file
)
resolved_archive_file
=
cached_path
(
archive_file
,
cache_dir
=
cache_dir
)
except
FileNotFoundError
:
except
FileNotFoundError
:
logger
.
error
(
logger
.
error
(
"Model name '{}' was not found in model name list ({}). "
"Model name '{}' was not found in model name list ({}). "
...
...
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