
    {bj&                        S r SSKrSSKJr  SSKJr  SSKJr  SSKJ	r	  SSK
JrJr  SSKJrJr  S	S
KJrJrJrJrJr  S	SKJrJr  S	SKJr  / SQr           S%S\S\\\   S-  \" SS94   S\S\S\\\   S-  \" SS94   S\\\   S-  \" SS94   S\\S-  \" SS94   S\\S-  \" SS94   S\\\" SS94   S\\\" SS94   S \S!\\\" S"S94   S#S4S$ jjr g)&z=Contains command to download files from the Hub with the CLI.    N)	Annotated)	constants)snapshot_download)CLIError)DryRunFileInfohf_hub_download)_format_sizeparse_hf_uri   )	RepoIdArgRepoTypeRepoTypeOptionalOptRevisionOptTokenOpt)ArgumentOption)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 datasetz6hf download hf://datasets/HuggingFaceH4/ultrachat_200k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                 
  ^ ^^^^^^^^	^
^^ Tb  Tb  [        S5      eT R                  [        R                  5      (       a  Ub  [        ST  S35      eTb  [        ST  S35      e[	        T 5      nUR
                  (       a  [        S5      eUR                  nU(       a  T R                  S5      (       a  US-  nUR                  UR                  UR                  sm mmU(       a  T(       a  [        SU S	T S
35      eU/mO#U=(       d    [        R                  R                  m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.NzCannot use both `--local-dir` and `--cache-dir` at the same time. Use `--cache-dir` (or set the HF_HOME environment variable) for shared caching, or `--local-dir` for a one-off download to a specific directory.z3'--repo-type' cannot be used with an 'hf://' URI ('z').z2'--revision' cannot be used with an 'hf://' URI ('zBBuckets are not supported by `hf download`. Use `hf sync` instead./z.Cannot combine a file path in the hf:// URI ('z') with positional filenames .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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TUUTTTTSTTS9$ s  snf s  snf s  snf )Nr#   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 been explicitly set.z>Ignoring `--exclude` since filenames have been 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   r   )filenames_listf
subfolderssubfolder_patternsregular_filenamesr(   r)   r   r   r   r   r   r   r   r    r   repo_type_strr   r   s          ژ/tmp/claude-0/-home-danvics-docker-quiz/c1e0577a-e42c-4a3d-b1ea-3edd61103a4e/scratchpad/stt/lib/python3.13/site-packages/huggingface_hub/cli/download.pyrun_downloaddownload.<locals>.run_download   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 #)+)*#
 	
e DHNs   F0F0F5F:6F:resultc           
         [        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[        S U 5       5      (       a  S O[        S U 5       5      n[        R                  " S[        U5       S[        U 5       SUb  [        U5      OS S	35        [        U S
 S9 Vs/ s HE  nUR                  UR
                  (       a"  UR                  b  [        UR                  5      OSS.PMG     nn[        R                  " U5        g s  snf s  snf )N
Downloaded)pathc              3   <   #    U  H  oR                   S L v   M     g 7fN	file_size.0rs     r5   	<genexpr>2download.<locals>._print_result.<locals>.<genexpr>   s     C]t+]s   c              3   J   #    U  H  oR                   =(       d    S v   M     g7f)r   Nr>   r@   s     r5   rC   rD      s     Lugtbc[[M]\]M]gts   !#z[dry-run] Will download z files (out of z) totalling zan unknown sizer$   c                     U R                   $ r=   )r&   )xs    r5   <lambda>1download.<locals>._print_result.<locals>.<lambda>   s    QZZ    )key-)filesize)
isinstancestrr   r8   r   will_downloadanysumtextr,   r	   sortedr&   r?   table)r8   rB   rQ   
total_sizeinfoitemss         r5   _print_resultdownload.<locals>._print_result   s/   fc""JJ|&1 fn--XF$*>FqooF>C]CCCDLugtLuIu 	 	&s='9&: ;F} %6@6L,z2Rcddeg	
 v+?@

 A 8<8J8Jt~~OiT^^4or A 	 
 			%! ?
s   E E AE
)r   
startswithr   HF_PROTOCOLr
   	is_bucketpath_in_repor*   idtyper   r   modelvaluerP   r   list)r   r   r   r   r   r   r   r   r   r   r   r    urir_   r6   rZ   r4   s   `` `````````    @r5   downloadrf   (   s{   n !6O
 	
 )//00 PQXPYY\]^^OPWyX[\]]7#==_`` ''G,,S11CL+.66388S\\(D\NRopyozz{|  &I"4hnn;;D
#.n1EE D
 D
 D
LcN2T.5II d 4 ,.!rJ   )NNNNNNNFFN   )!__doc__r-   typingr   huggingface_hubr   "huggingface_hub._snapshot_downloadr   huggingface_hub.errorsr   huggingface_hub.file_downloadr   r   huggingface_hub.utilsr	   r
   
_cli_utilsr   r   r   r   r   
_frameworkr   r   _outputr   DOWNLOAD_EXAMPLESrd   rP   boolintrf    rJ   r5   <module>rv      s   D   % @ + I < W W (  " 	%)  	 	 	 	 	 	 	
i|"|"S	DQ	
	|" #|" |" S	DN	
	|"  S	DC	
	!|", d
1	
	-|"8 d
 M	
	9|"D Y	
	E|"P T	
	Q|"\ ]|"^ X	
	_|"j 
k|"rJ   