[tests] remove deprecated tests for model loading (#29450)
* gix * fix style * remove equivalent tests * add back for image_processor * remove again
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user