mirror of
https://github.com/huggingface/transformers.git
synced 2025-07-31 02:02:21 +06:00
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:
parent
675e2d1663
commit
d76d2a2af7
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user