"git@developer.sourcefind.cn:chenpangpang/transformers.git" did not exist on "aef9aac312e58b76412672ab660db51f5e5f1555"
Unverified Commit 2dce350b authored by Sylvain Gugger's avatar Sylvain Gugger Committed by GitHub
Browse files

Fix _configuration_file argument getting passed to model (#15629)

parent 85aee09e
......@@ -580,7 +580,7 @@ class PretrainedConfig(PushToHubMixin):
if os.path.isfile(pretrained_model_name_or_path) or is_remote_url(pretrained_model_name_or_path):
config_file = pretrained_model_name_or_path
else:
configuration_file = kwargs.get("_configuration_file", CONFIG_NAME)
configuration_file = kwargs.pop("_configuration_file", CONFIG_NAME)
if os.path.isdir(pretrained_model_name_or_path):
config_file = os.path.join(pretrained_model_name_or_path, configuration_file)
......
......@@ -334,8 +334,12 @@ class ConfigurationVersioningTest(unittest.TestCase):
import transformers as new_transformers
new_transformers.configuration_utils.__version__ = "v4.0.0"
new_configuration = new_transformers.models.auto.AutoConfig.from_pretrained(repo)
new_configuration, kwargs = new_transformers.models.auto.AutoConfig.from_pretrained(
repo, return_unused_kwargs=True
)
self.assertEqual(new_configuration.hidden_size, 2)
# This checks `_configuration_file` ia not kept in the kwargs by mistake.
self.assertDictEqual(kwargs, {"_from_auto": True})
# Testing an older version by monkey-patching the version in the module it's used.
import transformers as old_transformers
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment