Make sure telemetry arguments are not returned as unused kwargs (#17063)
* Make sure telemetry arguments are not returned as unused kwargs * Fix test
This commit is contained in:
@@ -676,6 +676,10 @@ class PretrainedConfig(PushToHubMixin):
|
|||||||
[`PretrainedConfig`]: The configuration object instantiated from those parameters.
|
[`PretrainedConfig`]: The configuration object instantiated from those parameters.
|
||||||
"""
|
"""
|
||||||
return_unused_kwargs = kwargs.pop("return_unused_kwargs", False)
|
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)
|
config = cls(**config_dict)
|
||||||
|
|
||||||
|
|||||||
@@ -356,7 +356,7 @@ class ConfigurationVersioningTest(unittest.TestCase):
|
|||||||
)
|
)
|
||||||
self.assertEqual(new_configuration.hidden_size, 2)
|
self.assertEqual(new_configuration.hidden_size, 2)
|
||||||
# This checks `_configuration_file` ia not kept in the kwargs by mistake.
|
# 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.
|
# Testing an older version by monkey-patching the version in the module it's used.
|
||||||
import transformers as old_transformers
|
import transformers as old_transformers
|
||||||
|
|||||||
Reference in New Issue
Block a user