Ë
    ëÿæiu  ã                   óž  — d Z ddlZddlmZ ddlZddlmZ ddlmZ ddl	m
Z
mZ ddlmZ dd	lmZmZmZmZmZ dd
lmZmZ g d¢Zdej0                  dddddddddej2                  fdedeee   dz   ej8                  d¬«      f   dededeee   dz   ej:                  d¬«      f   deee   dz   ej:                  d¬«      f   deedz   ej:                  d¬«      f   deedz   ej:                  d¬«      f   dee ej:                  d¬«      f   dee ej:                  d¬«      f   d ed!ee ej:                  d"¬«      f   d#ed$dfd%„Z y)&a½  Contains command to download files from the Hub with the CLI.

Usage:
    hf download --help

    # Download file
    hf download gpt2 config.json

    # Download entire repo
    hf download fffiloni/zeroscope --repo-type=space --revision=refs/pr/78

    # Download repo with filters
    hf download gpt2 --include="*.safetensors"

    # Download with token
    hf download Wauplin/private-model --token=hf_***

    # Download quietly (no progress bar, no warnings, only the returned path)
    hf download gpt2 config.json --quiet

    # Download to local dir
    hf download gpt2 --local-dir=./models/gpt2

    # Download a subfolder
    hf download HuggingFaceM4/FineVision art/ --repo-type=dataset
é    N)Ú	Annotated)Úsnapshot_download)ÚCLIError)ÚDryRunFileInfoÚhf_hub_download)Ú_format_sizeé   )ÚFormatWithAutoOptÚ	RepoIdArgÚRepoTypeOptÚRevisionOptÚTokenOpt)ÚOutputFormatWithAutoÚout)z,hf download meta-llama/Llama-3.2-1B-InstructzGhf download meta-llama/Llama-3.2-1B-Instruct config.json tokenizer.jsonzXhf download meta-llama/Llama-3.2-1B-Instruct --include "*.safetensors" --exclude "*.bin"zGhf download meta-llama/Llama-3.2-1B-Instruct --local-dir ./models/llamaz=hf download HuggingFaceM4/FineVision art/ --repo-type datasetFé   Úrepo_idÚ	filenamesz>Files to download (e.g. `config.json`, `data/metadata.jsonl`).)ÚhelpÚ	repo_typeÚrevisionÚincludez;Glob patterns to include from files to download. eg: *.jsonÚexcludez0Glob patterns to exclude from files to download.Ú	cache_dirzDirectory where to save files.Ú	local_dirz¹If set, the downloaded file will be placed under this directory. Check out https://huggingface.co/docs/huggingface_hub/guides/download#download-files-to-a-local-folder for more details.Úforce_downloadzFIf True, the files will be downloaded even if they are already cached.Údry_runzAIf True, perform a dry run without actually downloading the file.ÚtokenÚmax_workerszEMaximum number of workers to use for downloading files. Default is 8.ÚformatÚreturnc                 óÐ   ‡ ‡‡‡‡‡‡‡‡‡	‡
‡— dt         t        z  t        t           z  fˆˆ	ˆˆˆˆˆˆˆ ˆˆˆ
fd„}dt         t        z  t        t           z  ddfd„} | |«       «       y)zDownload files from the Hub.r    c                  ón  •— ‰
�‰
ng } | D �cg c]  }|j                  d«      sŒ|‘Œ }}|D �cg c]  }|j                  d«      › d�‘Œ }}| D �cg c]  }|j                  d«      rŒ|‘Œ }}t        |«      dkD  rP‰�&t        ‰«      dkD  rt        d|d   › d|d   › d�«      ‚‰	�&t        ‰	«      dkD  rt        d|d   › d|d   › d�«      ‚t        |«      dkD  rJ‰�#t        ‰«      dkD  rt	        j
                  d	«       ‰	�#t        ‰	«      dkD  rt	        j
                  d
«       t        |«      dk(  r0t        |«      dk(  r"t        ‰‰j                  ‰|d   ‰‰‰‰d‰¬«
      S t        |«      dk(  rt        |«      dk(  r‰}‰	}n||z   }d }t        ‰‰j                  ‰||‰‰‰‰d‰‰¬«      S c c}w c c}w c c}w )NÚ/z/**r   z$Cannot combine subfolder argument ('z,') with `--include`. Please use `--include "z*"` instead.z,') with `--exclude`. Please use `--include "z*"` with `--exclude` instead.z?Ignoring `--include` since filenames have being explicitly set.z?Ignoring `--exclude` since filenames have being explicitly set.r	   zhuggingface-cli)
r   r   r   Úfilenamer   r   r   r   Úlibrary_namer   )r   r   r   Úallow_patternsÚignore_patternsr   r   r   r   r%   r   r   )	ÚendswithÚrstripÚlenr   ÚwarningsÚwarnr   Úvaluer   )Úfilenames_listÚfÚ
subfoldersÚsubfolder_patternsÚregular_filenamesr&   r'   r   r   r   r   r   r   r   r   r   r   r   r   s          €€€€€€€€€€€€úq/Volumes/fast/ai/experiments/voice-extract-mac/.venv/lib/python3.12/site-packages/huggingface_hub/cli/download.pyÚrun_downloadzdownload.<locals>.run_downloady   s  ø€ Ø&/Ð&;™Àˆñ "0ÓC¡˜A°1·:±:¸cµ?’a ˆ
ÐCÙ=GÓH¹Z¸ §¡¨#£ ¨sÒ3¸ZÐÐHÙ(6ÓN© 1¸a¿j¹jÈ½ošQ¨ÐÐNô Ð!Ó" QÒ&ØÐ"¤s¨7£|°aÒ'7ÜØ:¸:Àa¹=¸/ð J.Ø.8¸©m¨_¸LðJóð ð Ð"¤s¨7£|°aÒ'7ÜØ:¸:Àa¹=¸/ð J.Ø.8¸©m¨_Ð<Yð[óð ô Ð Ó! AÒ%ØÐ"¤s¨7£|°aÒ'7Ü—‘Ð_Ô`ØÐ"¤s¨7£|°aÒ'7Ü—‘Ð_Ô`ô Ð Ó! QÒ&¬3Ð/AÓ+BÀaÒ+GÜ"ØØ#Ÿ/™/Ø!Ø*¨1Ñ-Ø#Ø-ØØ#Ø.Øôð ô Ð Ó! QÒ&¬3Ð/AÓ+BÀaÒ+Gà$ˆNØ%‰Oð /Ð1CÑCˆNØ"ˆOä ØØ—o‘oØØ)Ø+Ø)ØØØØ*Ø#Øô
ð 	
ùòe DùÚHùÚNs   ŒF(£F(­F-ÁF2Á%F2ÚresultNc                 ó  — t        | t        «      rt        j                  d| ¬«       y t        | t        «      r| g} | D �cg c]  }|j
                  sŒ|‘Œ }}t        j                  dt        |«      › dt        | «      › dt        t        d„ |D «       «      «      › d�«       t        | d„ ¬	«      D �cg c]2  }|j                  |j
                  rt        |j                  «      nd
dœ‘Œ4 }}t        j                  |«       y c c}w c c}w )NÚ
Downloaded)Úpathz[dry-run] Will download z files (out of z) totalling c              3   ó4   K  — | ]  }|j                   –— Œ y ­w©N)Ú	file_size)Ú.0Úrs     r3   Ú	<genexpr>z2download.<locals>._print_result.<locals>.<genexpr>Ë   s   è ø€ Ð*NÁ¸1¨1¯;­;Áùs   ‚Ú.c                 ó   — | j                   S r:   )r$   )Úxs    r3   Ú<lambda>z1download.<locals>._print_result.<locals>.<lambda>Ò   s   € °Q·Z²Zó    )ÚkeyÚ-)ÚfileÚsize)Ú
isinstanceÚstrr   r5   r   Úwill_downloadÚtextr*   r   ÚsumÚsortedr$   r;   Útable)r5   r=   rJ   ÚinfoÚitemss        r3   Ú_print_resultzdownload.<locals>._print_result¿   sý   € Ü�fœcÔ"Ü�J‰J�|¨&Õ1Øô �fœnÔ-Ø�XˆFÙ$*Ó>¡F˜q¨a¯o«oš FˆÐ>Ü�‰Ø&¤s¨=Ó'9Ð&:ð ;Ü˜F›�}ð %Ü&¤sÑ*NÁÓ*NÓ'NÓOÐPÐPQðSô	
ô ˜vÑ+?Õ@ó
ñ
 A�ð Ÿ™Ø8<×8JÒ8Jœ T§^¡^Ô4ÐPSóð Að 	ð 
ô 	�	‰	�%Õùò ?ùò
s   Á DÁDÂ27D)rI   r   Úlist)r   r   r   r   r   r   r   r   r   r   r   r   r   r4   rQ   s   ````````````   r3   ÚdownloadrS   @   s]   ÿû€ ðrD
œ#¤Ñ.´´nÑ1EÑE÷ D
÷ D
ð D
ðLœc¤NÑ2´T¼.Ñ5IÑIð Èdó ñ. ‘,“.Õ!rC   )!Ú__doc__r+   Útypingr   ÚtyperÚ"huggingface_hub._snapshot_downloadr   Úhuggingface_hub.errorsr   Úhuggingface_hub.file_downloadr   r   Úhuggingface_hub.utilsr   Ú
_cli_utilsr
   r   r   r   r   Ú_outputr   r   ÚDOWNLOAD_EXAMPLESÚmodelÚautorR   rI   ÚArgumentÚOptionÚboolÚintrS   © rC   r3   Ú<module>re      s1  ðñó6 Ý ã å @Ý +ß IÝ .ç XÕ Xß .òÐ ð  	Ø(×.Ñ.Ø ð 	ð 	ð 	ð 	ð 	ð 	Øð 	
Ø 4× 9Ñ 9ñkV"ØðV"àØˆS‰	�DÑØˆ�‰ØQô	
ð	ñðV"ð ðV"ð ðV"ð ØˆS‰	�DÑØˆ�‰ØNô	
ð	ñðV"ð  ØˆS‰	�DÑØˆ�‰ØCô	
ð	ñð!V"ð, Øˆd‰
Øˆ�‰Ø1ô	
ð	ñð-V"ð8 Øˆd‰
Øˆ�‰ð Mô	
ð	ñð9V"ðD ØØˆ�‰ØYô	
ð	ñðEV"ðP ØØˆ�‰ØTô	
ð	ñðQV"ð\ ð]V"ð^ ØØˆ�‰ØXô	
ð	ñð_V"ðj ðkV"ðl 
ômV"rC   