3737import torch .nn as nn
3838from accelerate .utils .modeling import _get_proper_dtype , compute_module_sizes , dtype_byte_size
3939from huggingface_hub import ModelCard , delete_repo , snapshot_download , try_to_load_from_cache
40- from huggingface_hub .utils import is_jinja_available
40+ from huggingface_hub .utils import HfHubHTTPError , is_jinja_available
4141from parameterized import parameterized
42- from requests .exceptions import HTTPError
4342
4443from diffusers .models import FluxTransformer2DModel , SD3Transformer2DModel , UNet2DConditionModel
4544from diffusers .models .attention_processor import (
@@ -272,7 +271,7 @@ def test_cached_files_are_used_when_no_internet(self):
272271 response_mock = mock .Mock ()
273272 response_mock .status_code = 500
274273 response_mock .headers = {}
275- response_mock .raise_for_status .side_effect = HTTPError
274+ response_mock .raise_for_status .side_effect = HfHubHTTPError ( "Server down" , response = mock . Mock ())
276275 response_mock .json .return_value = {}
277276
278277 # Download this model to make sure it's in the cache.
@@ -296,7 +295,7 @@ def test_local_files_only_with_sharded_checkpoint(self):
296295 error_response = mock .Mock (
297296 status_code = 500 ,
298297 headers = {},
299- raise_for_status = mock .Mock (side_effect = HTTPError ),
298+ raise_for_status = mock .Mock (side_effect = HfHubHTTPError ( "Server down" , response = mock . Mock ()) ),
300299 json = mock .Mock (return_value = {}),
301300 )
302301
0 commit comments