Unverified Commit d76d2a2a authored by Sylvain Gugger's avatar Sylvain Gugger Committed by GitHub
Browse files

Make sure telemetry arguments are not returned as unused kwargs (#17063)

* Make sure telemetry arguments are not returned as unused kwargs

* Fix test
parent 675e2d16
......@@ -676,6 +676,10 @@ class PretrainedConfig(PushToHubMixin):
[`PretrainedConfig`]: The configuration object instantiated from those parameters.
"""
return_unused_kwargs = kwargs.pop("return_unused_kwargs", False)
# Those arguments may be passed along for our internal telemetry.
# We remove them so they don't appear in `return_unused_kwargs`.
kwargs.pop("_from_auto", None)
kwargs.pop("_from_pipeline", None)
config = cls(**config_dict)
......
......@@ -356,7 +356,7 @@ class ConfigurationVersioningTest(unittest.TestCase):
)
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})
self.assertDictEqual(kwargs, {})
# 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