diff --git a/tests/test_configuration_utils.py b/tests/test_configuration_utils.py index 5c9861e48b..9b1c6c25b3 100644 --- a/tests/test_configuration_utils.py +++ b/tests/test_configuration_utils.py @@ -248,12 +248,6 @@ class ConfigTestUtils(unittest.TestCase): # This check we did call the fake head request mock_head.assert_called() - def test_legacy_load_from_url(self): - # This test is for deprecated behavior and can be removed in v5 - _ = BertConfig.from_pretrained( - "https://huggingface.co/hf-internal-testing/tiny-random-bert/resolve/main/config.json" - ) - def test_local_versioning(self): configuration = AutoConfig.from_pretrained("google-bert/bert-base-cased") configuration.configuration_files = ["config.4.0.0.json"] diff --git a/tests/test_feature_extraction_utils.py b/tests/test_feature_extraction_utils.py index 7467cac139..d88fcb2760 100644 --- a/tests/test_feature_extraction_utils.py +++ b/tests/test_feature_extraction_utils.py @@ -52,12 +52,6 @@ class FeatureExtractorUtilTester(unittest.TestCase): # This check we did call the fake head request mock_head.assert_called() - def test_legacy_load_from_url(self): - # This test is for deprecated behavior and can be removed in v5 - _ = Wav2Vec2FeatureExtractor.from_pretrained( - "https://huggingface.co/hf-internal-testing/tiny-random-wav2vec2/resolve/main/preprocessor_config.json" - ) - @is_staging_test class FeatureExtractorPushToHubTester(unittest.TestCase): diff --git a/tests/test_image_processing_utils.py b/tests/test_image_processing_utils.py index 3be8ee3c26..bab0769c92 100644 --- a/tests/test_image_processing_utils.py +++ b/tests/test_image_processing_utils.py @@ -51,12 +51,6 @@ class ImageProcessorUtilTester(unittest.TestCase): # This check we did call the fake head request mock_head.assert_called() - def test_legacy_load_from_url(self): - # This test is for deprecated behavior and can be removed in v5 - _ = ViTImageProcessor.from_pretrained( - "https://huggingface.co/hf-internal-testing/tiny-random-vit/resolve/main/preprocessor_config.json" - ) - def test_image_processor_from_pretrained_subfolder(self): with self.assertRaises(OSError): # config is in subfolder, the following should not work without specifying the subfolder diff --git a/tests/test_modeling_tf_utils.py b/tests/test_modeling_tf_utils.py index 9ab60db781..c2381b91a5 100644 --- a/tests/test_modeling_tf_utils.py +++ b/tests/test_modeling_tf_utils.py @@ -25,7 +25,6 @@ import unittest import unittest.mock as mock from huggingface_hub import HfFolder, Repository, delete_repo, snapshot_download -from huggingface_hub.file_download import http_get from requests.exceptions import HTTPError from transformers import is_tf_available, is_torch_available @@ -106,24 +105,6 @@ class TFModelUtilsTest(unittest.TestCase): # This check we did call the fake head request mock_head.assert_called() - def test_load_from_one_file(self): - try: - tmp_file = tempfile.mktemp() - with open(tmp_file, "wb") as f: - http_get("https://huggingface.co/hf-internal-testing/tiny-random-bert/resolve/main/tf_model.h5", f) - - config = BertConfig.from_pretrained("hf-internal-testing/tiny-random-bert") - _ = TFBertModel.from_pretrained(tmp_file, config=config) - finally: - os.remove(tmp_file) - - def test_legacy_load_from_url(self): - # This test is for deprecated behavior and can be removed in v5 - config = BertConfig.from_pretrained("hf-internal-testing/tiny-random-bert") - _ = TFBertModel.from_pretrained( - "https://huggingface.co/hf-internal-testing/tiny-random-bert/resolve/main/tf_model.h5", config=config - ) - # tests whether the unpack_inputs function behaves as expected def test_unpack_inputs(self): class DummyModel: diff --git a/tests/test_modeling_utils.py b/tests/test_modeling_utils.py index 4bc66b7575..c88b9c8870 100755 --- a/tests/test_modeling_utils.py +++ b/tests/test_modeling_utils.py @@ -27,7 +27,6 @@ from pathlib import Path import requests from huggingface_hub import HfApi, HfFolder, delete_repo -from huggingface_hub.file_download import http_get from pytest import mark from requests.exceptions import HTTPError @@ -879,26 +878,6 @@ class ModelUtilsTest(TestCasePlus): # This check we did call the fake head request mock_head.assert_called() - def test_load_from_one_file(self): - try: - tmp_file = tempfile.mktemp() - with open(tmp_file, "wb") as f: - http_get( - "https://huggingface.co/hf-internal-testing/tiny-random-bert/resolve/main/pytorch_model.bin", f - ) - - config = BertConfig.from_pretrained("hf-internal-testing/tiny-random-bert") - _ = BertModel.from_pretrained(tmp_file, config=config) - finally: - os.remove(tmp_file) - - def test_legacy_load_from_url(self): - # This test is for deprecated behavior and can be removed in v5 - config = BertConfig.from_pretrained("hf-internal-testing/tiny-random-bert") - _ = BertModel.from_pretrained( - "https://huggingface.co/hf-internal-testing/tiny-random-bert/resolve/main/pytorch_model.bin", config=config - ) - @require_safetensors def test_use_safetensors(self): # Should not raise anymore diff --git a/tests/test_tokenization_utils.py b/tests/test_tokenization_utils.py index 3f23fdb156..885c6d6d2e 100644 --- a/tests/test_tokenization_utils.py +++ b/tests/test_tokenization_utils.py @@ -108,10 +108,6 @@ class TokenizerUtilTester(unittest.TestCase): finally: os.remove("tokenizer.json") - def test_legacy_load_from_url(self): - # This test is for deprecated behavior and can be removed in v5 - _ = AlbertTokenizer.from_pretrained("https://huggingface.co/albert/albert-base-v1/resolve/main/spiece.model") - @is_staging_test class TokenizerPushToHubTester(unittest.TestCase):