wL iv dZddlZddlmZmZddlmZmZddlm Z ddl m Z ddl m Z ddlmZdd lmZmZd d lmZe j*eZGd d e Zy)aContains command to download files from the Hub with the CLI. Usage: huggingface-cli download --help # Download file huggingface-cli download gpt2 config.json # Download entire repo huggingface-cli download fffiloni/zeroscope --repo-type=space --revision=refs/pr/78 # Download repo with filters huggingface-cli download gpt2 --include="*.safetensors" # Download with token huggingface-cli download Wauplin/private-model --token=hf_*** # Download quietly (no progress bar, no warnings, only the returned path) huggingface-cli download gpt2 config.json --quiet # Download to local dir huggingface-cli download gpt2 --local-dir=./models/gpt2 N) Namespace_SubParsersAction)ListOptional)logging)snapshot_download)BaseHuggingfaceCLICommand)hf_hub_download)disable_progress_barsenable_progress_bars)show_deprecation_warningcFeZdZedefdZdeddfdZd dZde fdZ y) DownloadCommandparserc|jdd}|jdtd|jdtdd |jd gd d d|jdtd|jddtd|jddtd|jdtd|jdtd|jdgdd|jdd d!"|jd#d d$"|jd%td&|jd'd d("|jd)td*d+,|j t -y).NdownloadzDownload files from the Hub)helprepo_idzFiles to download (e.g. `config.json`, `data/metadata.jsonl`).)rnargsrz --repo-type)modeldatasetspacerz4Type of repo to download from (defaults to 'model').)choicesdefaultrz --revisionzPAn optional Git revision id which can be a branch name, a tag, or a commit hash.z --includez)Glob patterns to match files to download.)rrrz --excludez0Glob patterns to exclude from files to download.z --cache-dirz9Path to the directory where to save the downloaded files.z --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.z--local-dir-use-symlinks)autoTrueFalsezWDeprecated and ignored. Downloading to a local directory does not use symlinks anymore.)rrz--force-download store_truezFIf True, the files will be downloaded even if they are already cached.)actionrz--resume-downloadzDeprecated and ignored. Downloading a file to local dir always attempts to resume previously interrupted downloads (unless hf-transfer is enabled).z--tokenzIA User Access Token generated from https://huggingface.co/settings/tokensz--quietzWIf True, progress bars are disabled and only the path to the download files is printed.z --max-workerszEMaximum number of workers to use for downloading files. Default is 8.)rrr)func) add_parser add_argumentstrint set_defaultsr)rdownload_parsers g/mnt/ssd/data/python-lab/Trading/venv/lib/python3.12/site-packages/huggingface_hub/commands/download.pyregister_subcommandz#DownloadCommand.register_subcommand8s ++J=Z+[$$ C&d %  $$ c3s %  $$ 1G % $$ c % $$ s3^ %  $$ s3e %  $$ *e %  $$  %  $$ &-k % $$ Y % $$ g % $$ C&q %  $$ j % $$ X % $$/$:argsreturnNc|j|_|j|_|j|_|j|_|j|_|j |_|j |_|j|_|j|_|j|_ |jxsd|_ |j|_ |j|_ |jtjdt yy)NzbIgnoring --local-dir-use-symlinks. Downloading to a local directory does not use symlinks anymore.)tokenrr repo_typerevisionincludeexclude cache_dir local_dirforce_downloadresume_downloadquiet max_workerslocal_dir_use_symlinkswarningswarn FutureWarning)selfr/s r,__init__zDownloadCommand.__init__}sZZ  LL $(NN"nn'+}} ,0LL ,0LL (,(,$($7$7/3/C/C/Kt:: $ 0 0  & & 2 MMt  3r.ctdd|jr`ttj5tj dt |jdddtytjt |jtjy#1swYtyxYw)Nzhuggingface-cli downloadz hf downloadignore) rr;r r>catch_warnings simplefilterprint _downloadr rset_verbosity_infoset_verbosity_warning)rAs r,runzDownloadCommand.runs !;]K :: ! #((* (%%h/dnn&' ( ! "  & & ( $.." #  ) ) + ( ! "s /B;;Cct|jdkDrr|j-t|jdkDrtjd|j -t|j dkDrtjdt|jdk(rrt |j|j|j|jd|j|j|j|j|jd St|jdk(r|j}|j }n|j}d}t|j|j|j|||j|j|j|j|jd|j  S)Nrz?Ignoring `--include` since filenames have being explicitly set.z?Ignoring `--exclude` since filenames have being explicitly set.r zhuggingface-cli) rr3r4filenamer7r:r9r2r8 library_name) rr3r4allow_patternsignore_patternsr:r9r7r2r8rNr<)lenrr5r>r?r6r rr3r4r7r:r9r2r8rr<)rArOrPs r,rHzDownloadCommand._downloadsZ t~~  "||'C ,=,A _`||'C ,=,A _` t~~ ! #" ..*.. $ 4 4#22jj...   A %!\\N"llO!^^N"O LLnn]])+ 00..nn**nn*((  r.)r0N) __name__ __module__ __qualname__ staticmethodrr-rrBrKr(rHr.r,rr7sDB;$5B;B;HY4* ,, 3, r.r)__doc__r>argparserrtypingrrhuggingface_hubr"huggingface_hub._snapshot_downloadrhuggingface_hub.commandsr huggingface_hub.file_downloadr huggingface_hub.utilsr r _cli_utilsr get_loggerrRloggerrrVr.r,rbsJ01!#@>9M0   H %U /U r.