Skip to content

Commit c3749f1

Browse files
committed
Pass through additional arguments from HfApi.hf_hub_download
1 parent c350eed commit c3749f1

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

src/huggingface_hub/hf_api.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5216,6 +5216,7 @@ def hf_hub_download(
52165216
etag_timeout: float = constants.DEFAULT_ETAG_TIMEOUT,
52175217
token: Union[bool, str, None] = None,
52185218
local_files_only: bool = False,
5219+
tqdm_class: Optional[type[base_tqdm]] = None,
52195220
dry_run: Literal[False] = False,
52205221
) -> str: ...
52215222

@@ -5234,6 +5235,7 @@ def hf_hub_download(
52345235
etag_timeout: float = constants.DEFAULT_ETAG_TIMEOUT,
52355236
token: Union[bool, str, None] = None,
52365237
local_files_only: bool = False,
5238+
tqdm_class: Optional[type[base_tqdm]] = None,
52375239
dry_run: Literal[True],
52385240
) -> DryRunFileInfo: ...
52395241

@@ -5252,6 +5254,7 @@ def hf_hub_download(
52525254
etag_timeout: float = constants.DEFAULT_ETAG_TIMEOUT,
52535255
token: Union[bool, str, None] = None,
52545256
local_files_only: bool = False,
5257+
tqdm_class: Optional[type[base_tqdm]] = None,
52555258
dry_run: bool = False,
52565259
) -> Union[str, DryRunFileInfo]:
52575260
"""Download a given file if it's not already present in the local cache.
@@ -5320,6 +5323,11 @@ def hf_hub_download(
53205323
local_files_only (`bool`, *optional*, defaults to `False`):
53215324
If `True`, avoid downloading the file and return the path to the
53225325
local cached file if it exists.
5326+
tqdm_class (`tqdm`, *optional*):
5327+
If provided, overwrites the default behavior for the progress bar. Passed
5328+
argument must inherit from `tqdm.auto.tqdm` or at least mimic its behavior.
5329+
Defaults to the custom HF progress bar that can be disabled by setting
5330+
`HF_HUB_DISABLE_PROGRESS_BARS` environment variable.
53235331
dry_run (`bool`, *optional*, defaults to `False`):
53245332
If `True`, perform a dry run without actually downloading the file. Returns a
53255333
[`DryRunFileInfo`] object containing information about what would be downloaded.
@@ -5369,6 +5377,8 @@ def hf_hub_download(
53695377
token=token,
53705378
headers=self.headers,
53715379
local_files_only=local_files_only,
5380+
tqdm_class=tqdm_class,
5381+
dry_run=dry_run,
53725382
)
53735383

53745384
@validate_hf_hub_args

0 commit comments

Comments
 (0)