Skip to content

Commit e02ec27

Browse files
authored
[Core] remove resume_download from Hub related stuff (huggingface#8648)
* remove resume_download * fix: _fetch_index_file call. * remove resume_download from docs.
1 parent a41e4c5 commit e02ec27

24 files changed

+18
-142
lines changed

examples/community/checkpoint_merger.py

+1-4
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ def merge(self, pretrained_model_name_or_path_list: List[Union[str, os.PathLike]
7171
**kwargs:
7272
Supports all the default DiffusionPipeline.get_config_dict kwargs viz..
7373
74-
cache_dir, resume_download, force_download, proxies, local_files_only, token, revision, torch_dtype, device_map.
74+
cache_dir, force_download, proxies, local_files_only, token, revision, torch_dtype, device_map.
7575
7676
alpha - The interpolation parameter. Ranges from 0 to 1. It affects the ratio in which the checkpoints are merged. A 0.8 alpha
7777
would mean that the first model checkpoints would affect the final result far less than an alpha of 0.2
@@ -86,7 +86,6 @@ def merge(self, pretrained_model_name_or_path_list: List[Union[str, os.PathLike]
8686
"""
8787
# Default kwargs from DiffusionPipeline
8888
cache_dir = kwargs.pop("cache_dir", None)
89-
resume_download = kwargs.pop("resume_download", False)
9089
force_download = kwargs.pop("force_download", False)
9190
proxies = kwargs.pop("proxies", None)
9291
local_files_only = kwargs.pop("local_files_only", False)
@@ -124,7 +123,6 @@ def merge(self, pretrained_model_name_or_path_list: List[Union[str, os.PathLike]
124123
config_dict = DiffusionPipeline.load_config(
125124
pretrained_model_name_or_path,
126125
cache_dir=cache_dir,
127-
resume_download=resume_download,
128126
force_download=force_download,
129127
proxies=proxies,
130128
local_files_only=local_files_only,
@@ -160,7 +158,6 @@ def merge(self, pretrained_model_name_or_path_list: List[Union[str, os.PathLike]
160158
else snapshot_download(
161159
pretrained_model_name_or_path,
162160
cache_dir=cache_dir,
163-
resume_download=resume_download,
164161
proxies=proxies,
165162
local_files_only=local_files_only,
166163
token=token,

examples/community/ip_adapter_face_id.py

-2
Original file line numberDiff line numberDiff line change
@@ -267,7 +267,6 @@ def __init__(
267267
def load_ip_adapter_face_id(self, pretrained_model_name_or_path_or_dict, weight_name, **kwargs):
268268
cache_dir = kwargs.pop("cache_dir", None)
269269
force_download = kwargs.pop("force_download", False)
270-
resume_download = kwargs.pop("resume_download", False)
271270
proxies = kwargs.pop("proxies", None)
272271
local_files_only = kwargs.pop("local_files_only", None)
273272
token = kwargs.pop("token", None)
@@ -283,7 +282,6 @@ def load_ip_adapter_face_id(self, pretrained_model_name_or_path_or_dict, weight_
283282
weights_name=weight_name,
284283
cache_dir=cache_dir,
285284
force_download=force_download,
286-
resume_download=resume_download,
287285
proxies=proxies,
288286
local_files_only=local_files_only,
289287
token=token,

examples/community/stable_diffusion_tensorrt_img2img.py

-2
Original file line numberDiff line numberDiff line change
@@ -783,7 +783,6 @@ def __loadModels(self):
783783
@validate_hf_hub_args
784784
def set_cached_folder(cls, pretrained_model_name_or_path: Optional[Union[str, os.PathLike]], **kwargs):
785785
cache_dir = kwargs.pop("cache_dir", None)
786-
resume_download = kwargs.pop("resume_download", False)
787786
proxies = kwargs.pop("proxies", None)
788787
local_files_only = kwargs.pop("local_files_only", False)
789788
token = kwargs.pop("token", None)
@@ -795,7 +794,6 @@ def set_cached_folder(cls, pretrained_model_name_or_path: Optional[Union[str, os
795794
else snapshot_download(
796795
pretrained_model_name_or_path,
797796
cache_dir=cache_dir,
798-
resume_download=resume_download,
799797
proxies=proxies,
800798
local_files_only=local_files_only,
801799
token=token,

examples/community/stable_diffusion_tensorrt_inpaint.py

-2
Original file line numberDiff line numberDiff line change
@@ -783,7 +783,6 @@ def __loadModels(self):
783783
@validate_hf_hub_args
784784
def set_cached_folder(cls, pretrained_model_name_or_path: Optional[Union[str, os.PathLike]], **kwargs):
785785
cache_dir = kwargs.pop("cache_dir", None)
786-
resume_download = kwargs.pop("resume_download", False)
787786
proxies = kwargs.pop("proxies", None)
788787
local_files_only = kwargs.pop("local_files_only", False)
789788
token = kwargs.pop("token", None)
@@ -795,7 +794,6 @@ def set_cached_folder(cls, pretrained_model_name_or_path: Optional[Union[str, os
795794
else snapshot_download(
796795
pretrained_model_name_or_path,
797796
cache_dir=cache_dir,
798-
resume_download=resume_download,
799797
proxies=proxies,
800798
local_files_only=local_files_only,
801799
token=token,

examples/community/stable_diffusion_tensorrt_txt2img.py

-2
Original file line numberDiff line numberDiff line change
@@ -695,7 +695,6 @@ def __loadModels(self):
695695
@validate_hf_hub_args
696696
def set_cached_folder(cls, pretrained_model_name_or_path: Optional[Union[str, os.PathLike]], **kwargs):
697697
cache_dir = kwargs.pop("cache_dir", None)
698-
resume_download = kwargs.pop("resume_download", False)
699698
proxies = kwargs.pop("proxies", None)
700699
local_files_only = kwargs.pop("local_files_only", False)
701700
token = kwargs.pop("token", None)
@@ -707,7 +706,6 @@ def set_cached_folder(cls, pretrained_model_name_or_path: Optional[Union[str, os
707706
else snapshot_download(
708707
pretrained_model_name_or_path,
709708
cache_dir=cache_dir,
710-
resume_download=resume_download,
711709
proxies=proxies,
712710
local_files_only=local_files_only,
713711
token=token,

src/diffusers/configuration_utils.py

-5
Original file line numberDiff line numberDiff line change
@@ -310,9 +310,6 @@ def load_config(
310310
force_download (`bool`, *optional*, defaults to `False`):
311311
Whether or not to force the (re-)download of the model weights and configuration files, overriding the
312312
cached versions if they exist.
313-
resume_download:
314-
Deprecated and ignored. All downloads are now resumed by default when possible. Will be removed in v1
315-
of Diffusers.
316313
proxies (`Dict[str, str]`, *optional*):
317314
A dictionary of proxy servers to use by protocol or endpoint, for example, `{'http': 'foo.bar:3128',
318315
'http://hostname': 'foo.bar:4012'}`. The proxies are used on each request.
@@ -343,7 +340,6 @@ def load_config(
343340
local_dir = kwargs.pop("local_dir", None)
344341
local_dir_use_symlinks = kwargs.pop("local_dir_use_symlinks", "auto")
345342
force_download = kwargs.pop("force_download", False)
346-
resume_download = kwargs.pop("resume_download", None)
347343
proxies = kwargs.pop("proxies", None)
348344
token = kwargs.pop("token", None)
349345
local_files_only = kwargs.pop("local_files_only", False)
@@ -386,7 +382,6 @@ def load_config(
386382
cache_dir=cache_dir,
387383
force_download=force_download,
388384
proxies=proxies,
389-
resume_download=resume_download,
390385
local_files_only=local_files_only,
391386
token=token,
392387
user_agent=user_agent,

src/diffusers/loaders/ip_adapter.py

+1-5
Original file line numberDiff line numberDiff line change
@@ -90,9 +90,7 @@ def load_ip_adapter(
9090
force_download (`bool`, *optional*, defaults to `False`):
9191
Whether or not to force the (re-)download of the model weights and configuration files, overriding the
9292
cached versions if they exist.
93-
resume_download:
94-
Deprecated and ignored. All downloads are now resumed by default when possible. Will be removed in v1
95-
of Diffusers.
93+
9694
proxies (`Dict[str, str]`, *optional*):
9795
A dictionary of proxy servers to use by protocol or endpoint, for example, `{'http': 'foo.bar:3128',
9896
'http://hostname': 'foo.bar:4012'}`. The proxies are used on each request.
@@ -135,7 +133,6 @@ def load_ip_adapter(
135133
# Load the main state dict first.
136134
cache_dir = kwargs.pop("cache_dir", None)
137135
force_download = kwargs.pop("force_download", False)
138-
resume_download = kwargs.pop("resume_download", None)
139136
proxies = kwargs.pop("proxies", None)
140137
local_files_only = kwargs.pop("local_files_only", None)
141138
token = kwargs.pop("token", None)
@@ -171,7 +168,6 @@ def load_ip_adapter(
171168
weights_name=weight_name,
172169
cache_dir=cache_dir,
173170
force_download=force_download,
174-
resume_download=resume_download,
175171
proxies=proxies,
176172
local_files_only=local_files_only,
177173
token=token,

src/diffusers/loaders/lora.py

+2-12
Original file line numberDiff line numberDiff line change
@@ -170,9 +170,7 @@ def lora_state_dict(
170170
force_download (`bool`, *optional*, defaults to `False`):
171171
Whether or not to force the (re-)download of the model weights and configuration files, overriding the
172172
cached versions if they exist.
173-
resume_download:
174-
Deprecated and ignored. All downloads are now resumed by default when possible. Will be removed in v1
175-
of Diffusers.
173+
176174
proxies (`Dict[str, str]`, *optional*):
177175
A dictionary of proxy servers to use by protocol or endpoint, for example, `{'http': 'foo.bar:3128',
178176
'http://hostname': 'foo.bar:4012'}`. The proxies are used on each request.
@@ -194,7 +192,6 @@ def lora_state_dict(
194192
# UNet and text encoder or both.
195193
cache_dir = kwargs.pop("cache_dir", None)
196194
force_download = kwargs.pop("force_download", False)
197-
resume_download = kwargs.pop("resume_download", None)
198195
proxies = kwargs.pop("proxies", None)
199196
local_files_only = kwargs.pop("local_files_only", None)
200197
token = kwargs.pop("token", None)
@@ -235,7 +232,6 @@ def lora_state_dict(
235232
weights_name=weight_name or LORA_WEIGHT_NAME_SAFE,
236233
cache_dir=cache_dir,
237234
force_download=force_download,
238-
resume_download=resume_download,
239235
proxies=proxies,
240236
local_files_only=local_files_only,
241237
token=token,
@@ -261,7 +257,6 @@ def lora_state_dict(
261257
weights_name=weight_name or LORA_WEIGHT_NAME,
262258
cache_dir=cache_dir,
263259
force_download=force_download,
264-
resume_download=resume_download,
265260
proxies=proxies,
266261
local_files_only=local_files_only,
267262
token=token,
@@ -1427,9 +1422,7 @@ def lora_state_dict(
14271422
force_download (`bool`, *optional*, defaults to `False`):
14281423
Whether or not to force the (re-)download of the model weights and configuration files, overriding the
14291424
cached versions if they exist.
1430-
resume_download (`bool`, *optional*, defaults to `False`):
1431-
Whether or not to resume downloading the model weights and configuration files. If set to `False`, any
1432-
incompletely downloaded files are deleted.
1425+
14331426
proxies (`Dict[str, str]`, *optional*):
14341427
A dictionary of proxy servers to use by protocol or endpoint, for example, `{'http': 'foo.bar:3128',
14351428
'http://hostname': 'foo.bar:4012'}`. The proxies are used on each request.
@@ -1450,7 +1443,6 @@ def lora_state_dict(
14501443
# UNet and text encoder or both.
14511444
cache_dir = kwargs.pop("cache_dir", None)
14521445
force_download = kwargs.pop("force_download", False)
1453-
resume_download = kwargs.pop("resume_download", False)
14541446
proxies = kwargs.pop("proxies", None)
14551447
local_files_only = kwargs.pop("local_files_only", None)
14561448
token = kwargs.pop("token", None)
@@ -1481,7 +1473,6 @@ def lora_state_dict(
14811473
weights_name=weight_name or LORA_WEIGHT_NAME_SAFE,
14821474
cache_dir=cache_dir,
14831475
force_download=force_download,
1484-
resume_download=resume_download,
14851476
proxies=proxies,
14861477
local_files_only=local_files_only,
14871478
token=token,
@@ -1503,7 +1494,6 @@ def lora_state_dict(
15031494
weights_name=weight_name or LORA_WEIGHT_NAME,
15041495
cache_dir=cache_dir,
15051496
force_download=force_download,
1506-
resume_download=resume_download,
15071497
proxies=proxies,
15081498
local_files_only=local_files_only,
15091499
token=token,

src/diffusers/loaders/single_file.py

+1-9
Original file line numberDiff line numberDiff line change
@@ -242,7 +242,6 @@ def _download_diffusers_model_config_from_hub(
242242
revision,
243243
proxies,
244244
force_download=None,
245-
resume_download=None,
246245
local_files_only=None,
247246
token=None,
248247
):
@@ -253,7 +252,6 @@ def _download_diffusers_model_config_from_hub(
253252
revision=revision,
254253
proxies=proxies,
255254
force_download=force_download,
256-
resume_download=resume_download,
257255
local_files_only=local_files_only,
258256
token=token,
259257
allow_patterns=allow_patterns,
@@ -288,9 +286,7 @@ def from_single_file(cls, pretrained_model_link_or_path, **kwargs):
288286
cache_dir (`Union[str, os.PathLike]`, *optional*):
289287
Path to a directory where a downloaded pretrained model configuration is cached if the standard cache
290288
is not used.
291-
resume_download:
292-
Deprecated and ignored. All downloads are now resumed by default when possible. Will be removed in v1
293-
of Diffusers.
289+
294290
proxies (`Dict[str, str]`, *optional*):
295291
A dictionary of proxy servers to use by protocol or endpoint, for example, `{'http': 'foo.bar:3128',
296292
'http://hostname': 'foo.bar:4012'}`. The proxies are used on each request.
@@ -352,7 +348,6 @@ def from_single_file(cls, pretrained_model_link_or_path, **kwargs):
352348
deprecate("original_config_file", "1.0.0", deprecation_message)
353349
original_config = original_config_file
354350

355-
resume_download = kwargs.pop("resume_download", None)
356351
force_download = kwargs.pop("force_download", False)
357352
proxies = kwargs.pop("proxies", None)
358353
token = kwargs.pop("token", None)
@@ -382,7 +377,6 @@ def from_single_file(cls, pretrained_model_link_or_path, **kwargs):
382377

383378
checkpoint = load_single_file_checkpoint(
384379
pretrained_model_link_or_path,
385-
resume_download=resume_download,
386380
force_download=force_download,
387381
proxies=proxies,
388382
token=token,
@@ -412,7 +406,6 @@ def from_single_file(cls, pretrained_model_link_or_path, **kwargs):
412406
revision=revision,
413407
proxies=proxies,
414408
force_download=force_download,
415-
resume_download=resume_download,
416409
local_files_only=local_files_only,
417410
token=token,
418411
)
@@ -435,7 +428,6 @@ def from_single_file(cls, pretrained_model_link_or_path, **kwargs):
435428
revision=revision,
436429
proxies=proxies,
437430
force_download=force_download,
438-
resume_download=resume_download,
439431
local_files_only=False,
440432
token=token,
441433
)

src/diffusers/loaders/single_file_model.py

+1-5
Original file line numberDiff line numberDiff line change
@@ -137,9 +137,7 @@ def from_single_file(cls, pretrained_model_link_or_path_or_dict: Optional[str] =
137137
cache_dir (`Union[str, os.PathLike]`, *optional*):
138138
Path to a directory where a downloaded pretrained model configuration is cached if the standard cache
139139
is not used.
140-
resume_download (`bool`, *optional*, defaults to `False`):
141-
Whether or not to resume downloading the model weights and configuration files. If set to `False`, any
142-
incompletely downloaded files are deleted.
140+
143141
proxies (`Dict[str, str]`, *optional*):
144142
A dictionary of proxy servers to use by protocol or endpoint, for example, `{'http': 'foo.bar:3128',
145143
'http://hostname': 'foo.bar:4012'}`. The proxies are used on each request.
@@ -188,7 +186,6 @@ def from_single_file(cls, pretrained_model_link_or_path_or_dict: Optional[str] =
188186
"`from_single_file` cannot accept both `config` and `original_config` arguments. Please provide only one of these arguments"
189187
)
190188

191-
resume_download = kwargs.pop("resume_download", None)
192189
force_download = kwargs.pop("force_download", False)
193190
proxies = kwargs.pop("proxies", None)
194191
token = kwargs.pop("token", None)
@@ -203,7 +200,6 @@ def from_single_file(cls, pretrained_model_link_or_path_or_dict: Optional[str] =
203200
else:
204201
checkpoint = load_single_file_checkpoint(
205202
pretrained_model_link_or_path_or_dict,
206-
resume_download=resume_download,
207203
force_download=force_download,
208204
proxies=proxies,
209205
token=token,

src/diffusers/loaders/single_file_utils.py

-2
Original file line numberDiff line numberDiff line change
@@ -313,7 +313,6 @@ def _is_model_weights_in_cached_folder(cached_folder, name):
313313

314314
def load_single_file_checkpoint(
315315
pretrained_model_link_or_path,
316-
resume_download=False,
317316
force_download=False,
318317
proxies=None,
319318
token=None,
@@ -331,7 +330,6 @@ def load_single_file_checkpoint(
331330
weights_name=weights_name,
332331
force_download=force_download,
333332
cache_dir=cache_dir,
334-
resume_download=resume_download,
335333
proxies=proxies,
336334
local_files_only=local_files_only,
337335
token=token,

src/diffusers/loaders/textual_inversion.py

+1-6
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,6 @@
3838
def load_textual_inversion_state_dicts(pretrained_model_name_or_paths, **kwargs):
3939
cache_dir = kwargs.pop("cache_dir", None)
4040
force_download = kwargs.pop("force_download", False)
41-
resume_download = kwargs.pop("resume_download", None)
4241
proxies = kwargs.pop("proxies", None)
4342
local_files_only = kwargs.pop("local_files_only", None)
4443
token = kwargs.pop("token", None)
@@ -72,7 +71,6 @@ def load_textual_inversion_state_dicts(pretrained_model_name_or_paths, **kwargs)
7271
weights_name=weight_name or TEXT_INVERSION_NAME_SAFE,
7372
cache_dir=cache_dir,
7473
force_download=force_download,
75-
resume_download=resume_download,
7674
proxies=proxies,
7775
local_files_only=local_files_only,
7876
token=token,
@@ -93,7 +91,6 @@ def load_textual_inversion_state_dicts(pretrained_model_name_or_paths, **kwargs)
9391
weights_name=weight_name or TEXT_INVERSION_NAME,
9492
cache_dir=cache_dir,
9593
force_download=force_download,
96-
resume_download=resume_download,
9794
proxies=proxies,
9895
local_files_only=local_files_only,
9996
token=token,
@@ -308,9 +305,7 @@ def load_textual_inversion(
308305
force_download (`bool`, *optional*, defaults to `False`):
309306
Whether or not to force the (re-)download of the model weights and configuration files, overriding the
310307
cached versions if they exist.
311-
resume_download:
312-
Deprecated and ignored. All downloads are now resumed by default when possible. Will be removed in v1
313-
of Diffusers.
308+
314309
proxies (`Dict[str, str]`, *optional*):
315310
A dictionary of proxy servers to use by protocol or endpoint, for example, `{'http': 'foo.bar:3128',
316311
'http://hostname': 'foo.bar:4012'}`. The proxies are used on each request.

0 commit comments

Comments
 (0)