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
c6bf1a40
Commit
c6bf1a40
authored
Jul 11, 2019
by
thomwolf
Browse files
fix test examples et model pretrained
parent
92a782b1
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
4 additions
and
2 deletions
+4
-2
examples/test_examples.py
examples/test_examples.py
+2
-1
pytorch_transformers/modeling_utils.py
pytorch_transformers/modeling_utils.py
+1
-1
pytorch_transformers/tests/modeling_utils_test.py
pytorch_transformers/tests/modeling_utils_test.py
+1
-0
No files found.
examples/test_examples.py
View file @
c6bf1a40
...
@@ -56,7 +56,8 @@ class ExamplesTests(unittest.TestCase):
...
@@ -56,7 +56,8 @@ class ExamplesTests(unittest.TestCase):
"--learning_rate=1e-4"
,
"--learning_rate=1e-4"
,
"--max_steps=10"
,
"--max_steps=10"
,
"--warmup_steps=2"
,
"--warmup_steps=2"
,
"--overwrite_output_dir"
]
"--overwrite_output_dir"
,
"--seed=42"
]
model_name
=
"--model_name=bert-base-uncased"
model_name
=
"--model_name=bert-base-uncased"
with
patch
.
object
(
sys
,
'argv'
,
testargs
+
[
model_name
]):
with
patch
.
object
(
sys
,
'argv'
,
testargs
+
[
model_name
]):
result
=
run_glue
.
main
()
result
=
run_glue
.
main
()
...
...
pytorch_transformers/modeling_utils.py
View file @
c6bf1a40
...
@@ -49,7 +49,7 @@ class PretrainedConfig(object):
...
@@ -49,7 +49,7 @@ class PretrainedConfig(object):
self
.
torchscript
=
kwargs
.
pop
(
'torchscript'
,
False
)
self
.
torchscript
=
kwargs
.
pop
(
'torchscript'
,
False
)
@
classmethod
@
classmethod
def
from_pretrained
(
cls
,
pretrained_model_name_or_path
,
**
kwargs
):
def
from_pretrained
(
cls
,
pretrained_model_name_or_path
,
*
input
,
**
kwargs
):
"""
"""
Instantiate a PretrainedConfig from a pre-trained model configuration.
Instantiate a PretrainedConfig from a pre-trained model configuration.
...
...
pytorch_transformers/tests/modeling_utils_test.py
View file @
c6bf1a40
...
@@ -30,6 +30,7 @@ class ModelUtilsTest(unittest.TestCase):
...
@@ -30,6 +30,7 @@ class ModelUtilsTest(unittest.TestCase):
self
.
assertIsNotNone
(
config
)
self
.
assertIsNotNone
(
config
)
self
.
assertIsInstance
(
config
,
PretrainedConfig
)
self
.
assertIsInstance
(
config
,
PretrainedConfig
)
model
=
BertModel
.
from_pretrained
(
model_name
)
model
,
loading_info
=
BertModel
.
from_pretrained
(
model_name
,
output_loading_info
=
True
)
model
,
loading_info
=
BertModel
.
from_pretrained
(
model_name
,
output_loading_info
=
True
)
self
.
assertIsNotNone
(
model
)
self
.
assertIsNotNone
(
model
)
self
.
assertIsInstance
(
model
,
PreTrainedModel
)
self
.
assertIsInstance
(
model
,
PreTrainedModel
)
...
...
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