
    Y j                     P   S r SSKrSSKJr  SSKrSSKJr  SSKJr  SSK	J
r
Jr  SSKJr  SS	KJrJrJrJr  SS
KJr  / SQrS\R,                  SSSSSSSSS4S\S\\\   S-  \R2                  " SS94   S\S\S\\\   S-  \R4                  " SS94   S\\\   S-  \R4                  " SS94   S\\S-  \R4                  " SS94   S\\S-  \R4                  " SS94   S\\\R4                  " SS94   S\\\R4                  " SS94   S \S!\\\R4                  " S"S94   S#S4S$ jjrg)%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   )	RepoIdArgRepoTypeOptRevisionOptTokenOpt)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_dirzIf 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.returnc                    ^ ^^^^^^^^^	^
^ S[         [        -  [        [           -  4UU	UUUUUUU UUU
4S jjnS[         [        -  [        [           -  SS4S jnU" U" 5       5        g)zDownload files from the Hub.r   c                    > T
b  T
O/ n U  Vs/ s H  oR                  S5      (       d  M  UPM     nnU Vs/ s H  oR                  S5       S3PM     nnU  Vs/ s H  oR                  S5      (       a  M  UPM     nn[        U5      S:  aT  Tb'  [        T5      S:  a  [        SUS    SUS    S35      eT	b'  [        T	5      S:  a  [        SUS    SUS    S35      e[        U5      S:  aP  Tb%  [        T5      S:  a  [        R
                  " S	5        T	b%  [        T	5      S:  a  [        R
                  " S
5        [        U5      S:X  a.  [        U5      S:X  a  [        TTR                  TUS   TTTTSTS9
$ [        U5      S:X  a  [        U5      S:X  a  TnT	nOXC-   nS n[        TTR                  TUUTTTTSTTS9$ s  snf s  snf s  snf )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          m/root/GenerationalWealth/GenerationalWealth/venv/lib/python3.13/site-packages/huggingface_hub/cli/download.pyrun_downloaddownload.<locals>.run_downloadx   s   &/&; "0CA::c?a
C=GHZ#s3ZH(6N1jjoQN !"Q&"s7|a'7::a=/ J..8m_LJ  "s7|a'7::a=/ J..8m_<Y[   !A%"s7|a'7_`"s7|a'7_`  !Q&3/A+Ba+G"#//!*1-#-#.   !Q&3/A+Ba+G$N%O /CN"O oo)+)*#
 	
e DHNs   GGG	G6GresultNc                 D   [        U [        5      (       a  [        R                  " SU S9  g [        U [        5      (       a  U /n U  Vs/ s H  oR
                  (       d  M  UPM     nn[        R                  " S[        U5       S[        U 5       S[        [        S U 5       5      5       S35        [        U S S	9 Vs/ s H8  nUR                  UR
                  (       a  [        UR                  5      OS
S.PM:     nn[        R                  " U5        g s  snf s  snf )N
Downloaded)pathz[dry-run] Will download z files (out of z) totalling c              3   8   #    U  H  oR                   v   M     g 7fN)	file_size).0rs     r0   	<genexpr>2download.<locals>._print_result.<locals>.<genexpr>   s     *N1;;s   .c                     U R                   $ r8   )r!   )xs    r0   <lambda>1download.<locals>._print_result.<locals>.<lambda>   s    QZZ    )key-)filesize)
isinstancestrr   r3   r   will_downloadtextr'   r   sumsortedr!   r9   table)r3   r;   rJ   infoitemss        r0   _print_resultdownload.<locals>._print_result   s   fc""JJ|&1 fn--XF$*>FqooF>&s='9&: ;F} %&s*N*N'NOPPQS	
 v+?@

 A 8<8J8JT^^4PS A 	 
 			% ?
s   D D ?D)rI   r   list)r   r   r   r   r   r   r   r   r   r   r   r   r1   rQ   s   ````````````  r0   downloadrT   @   s]    pD
#.n1EE D
 D
 D
LcN2T.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   _outputr   DOWNLOAD_EXAMPLESmodelrS   rI   ArgumentOptionboolintrT    rC   r0   <module>re      s  6    @ + I . E E    	(..  	 	 	 	 	 	 	
iU"U"S	DQ	
	U" U" U" S	DN	
	U"  S	DC	
	!U", d
1	
	-U"8 d
 M	
	9U"D Y	
	EU"P T	
	QU"\ ]U"^ X	
	_U"j 
kU"rC   