Fix resume_download future warning (#31007)
* Fix resume_download future warning * better like this * Add regression test
This commit is contained in:
@@ -648,7 +648,7 @@ class PretrainedConfig(PushToHubMixin):
|
||||
) -> Tuple[Dict[str, Any], Dict[str, Any]]:
|
||||
cache_dir = kwargs.pop("cache_dir", None)
|
||||
force_download = kwargs.pop("force_download", False)
|
||||
resume_download = kwargs.pop("resume_download", False)
|
||||
resume_download = kwargs.pop("resume_download", None)
|
||||
proxies = kwargs.pop("proxies", None)
|
||||
token = kwargs.pop("token", None)
|
||||
local_files_only = kwargs.pop("local_files_only", False)
|
||||
|
||||
@@ -20,6 +20,7 @@ import sys
|
||||
import tempfile
|
||||
import unittest
|
||||
import unittest.mock as mock
|
||||
import warnings
|
||||
from pathlib import Path
|
||||
|
||||
from huggingface_hub import HfFolder, delete_repo
|
||||
@@ -306,3 +307,10 @@ class ConfigTestUtils(unittest.TestCase):
|
||||
self.assertTrue(config._has_non_default_generation_parameters())
|
||||
config = BertConfig(min_length=0) # `min_length = 0` is a default generation kwarg
|
||||
self.assertFalse(config._has_non_default_generation_parameters())
|
||||
|
||||
def test_loading_config_do_not_raise_future_warnings(self):
|
||||
"""Regression test for https://github.com/huggingface/transformers/issues/31002."""
|
||||
# Loading config should not raise a FutureWarning. It was the case before.
|
||||
with warnings.catch_warnings():
|
||||
warnings.simplefilter("error")
|
||||
PretrainedConfig.from_pretrained("bert-base-uncased")
|
||||
|
||||
Reference in New Issue
Block a user