fix: Use the HF API to disable the tqdm progress bars

Signed-off-by: Nikos Livathinos <nli@zurich.ibm.com>
This commit is contained in:
Nikos Livathinos 2024-12-09 14:25:18 +01:00
parent 04977aac9f
commit bb83bc3f8d

View File

@ -96,15 +96,10 @@ class StandardPdfPipeline(PaginatedPipeline):
def download_models_hf(
local_dir: Optional[Path] = None, force: bool = False
) -> Path:
from functools import partialmethod
from huggingface_hub import snapshot_download
from huggingface_hub.utils import disable_progress_bars
# Disable tqdm prints used by HF
from tqdm import tqdm
tqdm.__init__ = partialmethod(tqdm.__init__, disable=True)
disable_progress_bars()
download_path = snapshot_download(
repo_id="ds4sd/docling-models",
force_download=force,