
    AF[i                        d Z ddlZddlmZmZ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mZmZmZ dd	lmZmZmZmZ  ej0                  e      Zdej6                  dddddd
d
dd
dfdedeeee       ej<                  d      f   dededeeee       ej>                  d      f   deeee       ej>                  d      f   deee    ej>                  d      f   deee    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e! ej>                  d"      f   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
    N)	AnnotatedOptionalUnion)logging)snapshot_download)DryRunFileInfohf_hub_download)_format_sizedisable_progress_barsenable_progress_barstabulate   )	RepoIdArgRepoTypeOptRevisionOptTokenOptF   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-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quietzWIf True, progress bars are disabled and only the path to the download files is printed.max_workerszEMaximum number of workers to use for downloading files. Default is 8.returnc                    	
 dt         t        t        t        t           f   f	 
fd}dt         t        t        t        t           f   ddfd}|rTt	                t        j                         5  t        j                  d        | |              ddd       t                y | |              t        j                          y# 1 sw Y   t                yxY w)zDownload files from the Hub.r"   c                     ng } t        |       dkD  rJ#t              dkD  rt        j                  d       #t              dkD  rt        j                  d       t        |       dk(  r"t        j                  | d   	d
      S t        |       dk(  r}}n| }d }t        j                  ||	d
      S )Nr   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   )lenwarningswarnr	   valuer   )filenames_listr'   r(   r   r   r   r   r   r   r   r!   r   r   r   r   s      e/var/www/html/chatbot/moweb-chatbot/venv/lib/python3.12/site-packages/huggingface_hub/cli/download.pyrun_downloadzdownload.<locals>.run_downloadu   s    &/&;~""s7|a'7_`"s7|a'7_` ~!#"#//!'*#-#.  ~!#$N%O+N"O oo)+)*#
 	
    resultNc                    t        | t              rt        |        y t        | t              r| g} t        dt	        | D cg c]  }|j
                  s| c}       dt	        |        dt        t        d | D                     d       ddg}g }t        | d 	      D ]@  }|j                  |j                  |j
                  rt        |j                        nd
g       B t        t        ||             y c c}w )Nz[dry-run] Will download z files (out of z) totalling c              3   N   K   | ]  }|j                   s|j                    y wN)will_download	file_size).0rs     r.   	<genexpr>z2download.<locals>._print_result.<locals>.<genexpr>   sE       M}  ^_  mn  m|  m|  NO  NY  NY  M}s   %%.FilezBytes to downloadc                     | j                   S r4   )r%   )xs    r.   <lambda>z1download.<locals>._print_result.<locals>.<lambda>   s
     r0   )key-)headers)
isinstancestrprintr   r)   r5   r
   sumsortedappendr%   r6   r   )r1   r8   columnsitemsinfos        r.   _print_resultzdownload.<locals>._print_result   s   fc"&M fn-XF&sv+Q!A+Q'R&SSbcfgmcnboo{  }I  JM  M}  ci  M}  J}  }~  |  @  A	
 ./-/6';< 	gDLL$--I[I[dnn)Eadef	ghug./ ,Rs   C9C9ignore)r   rC   r   listr   r*   catch_warningssimplefilterr   r   set_verbosity_warning)r   r   r   r   r   r   r   r   r   r   r   r    r!   r/   rK   s   ``````````` `  r.   downloadrQ   7   s    |-
%^T.5I IJ -
 -
 -
^0eCn9M$MN 0SW 0" $$& 	*!!(+,.)	* 	ln%%%'	* 	s   #CC-)#__doc__r*   typingr   r   r   typerhuggingface_hubr   "huggingface_hub._snapshot_downloadr   huggingface_hub.file_downloadr   r	   huggingface_hub.utilsr
   r   r   r   
_cli_utilsr   r   r   r   
get_logger__name__loggermodelrM   rC   ArgumentOptionboolintrQ    r0   r.   <module>rc      sZ  0  - -  # @ I e e E E 
		H	% 	(..  	 	 	 	 	 	 	 	
uF(F(cQ	
	F( F( F( cN	
	F(  cC	
	!F(, 1	
	-F(8  K	
	9F(D Y	
	EF(P T	
	QF(\ ]F(^ j	
	_F(j X	
	kF(v 
wF(r0   