Skip to content

Commit c6bf1a4

Browse files
committed
fix test examples et model pretrained
1 parent 92a782b commit c6bf1a4

File tree

3 files changed

+4
-2
lines changed

3 files changed

+4
-2
lines changed

examples/test_examples.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,8 @@ def test_run_glue(self):
5656
"--learning_rate=1e-4",
5757
"--max_steps=10",
5858
"--warmup_steps=2",
59-
"--overwrite_output_dir"]
59+
"--overwrite_output_dir",
60+
"--seed=42"]
6061
model_name = "--model_name=bert-base-uncased"
6162
with patch.object(sys, 'argv', testargs + [model_name]):
6263
result = run_glue.main()

pytorch_transformers/modeling_utils.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ def __init__(self, **kwargs):
4949
self.torchscript = kwargs.pop('torchscript', False)
5050

5151
@classmethod
52-
def from_pretrained(cls, pretrained_model_name_or_path, **kwargs):
52+
def from_pretrained(cls, pretrained_model_name_or_path, *input, **kwargs):
5353
"""
5454
Instantiate a PretrainedConfig from a pre-trained model configuration.
5555

pytorch_transformers/tests/modeling_utils_test.py

+1
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ def test_model_from_pretrained(self):
3030
self.assertIsNotNone(config)
3131
self.assertIsInstance(config, PretrainedConfig)
3232

33+
model = BertModel.from_pretrained(model_name)
3334
model, loading_info = BertModel.from_pretrained(model_name, output_loading_info=True)
3435
self.assertIsNotNone(model)
3536
self.assertIsInstance(model, PreTrainedModel)

0 commit comments

Comments
 (0)