Skip to content

Commit 99bfce1

Browse files
authored
Multi-threaded snapshot download (#3522)
1 parent e2f6f26 commit 99bfce1

File tree

1 file changed

+8
-15
lines changed

1 file changed

+8
-15
lines changed

src/huggingface_hub/_snapshot_download.py

Lines changed: 8 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -403,21 +403,14 @@ def _inner_hf_hub_download(repo_file: str) -> None:
403403
)
404404
)
405405

406-
if constants.HF_XET_HIGH_PERFORMANCE and not dry_run:
407-
# when using hf_xet high performance we don't want extra parallelism
408-
# from the one hf_xet provides
409-
# TODO: revisit this when xet_session is implemented
410-
for file in filtered_repo_files:
411-
_inner_hf_hub_download(file)
412-
else:
413-
thread_map(
414-
_inner_hf_hub_download,
415-
filtered_repo_files,
416-
desc=tqdm_desc,
417-
max_workers=max_workers,
418-
# User can use its own tqdm class or the default one from `huggingface_hub.utils`
419-
tqdm_class=tqdm_class or hf_tqdm,
420-
)
406+
thread_map(
407+
_inner_hf_hub_download,
408+
filtered_repo_files,
409+
desc=tqdm_desc,
410+
max_workers=max_workers,
411+
# User can use its own tqdm class or the default one from `huggingface_hub.utils`
412+
tqdm_class=tqdm_class or hf_tqdm,
413+
)
421414

422415
if dry_run:
423416
assert all(isinstance(r, DryRunFileInfo) for r in results)

0 commit comments

Comments
 (0)