
    "j                     0   d Z ddlZddlmZmZ ddlZddlmZmZm	Z	 ddl
mZmZ ddlmZmZmZmZmZmZmZmZmZmZmZ ddlmZmZ  e ee                    Z ee          Z ej        d	d
 eD             e           Z!ee dz   ej"        dd#                    e           d ee                    f         Z$ ed          Z%e%&                    dg d          dddddddej'        df	dedededee dz   ej"        d          f         dee!dz   ej"        d          f         dede$ded ed!dfd"            Z(e%&                    d#d$d%g          ddej'        dfd&ee  ej)        d'          f         d(ede$ded ed!dfd)            Z*dS )*a  Contains commands to interact with models on the Hugging Face Hub.

Usage:
    # list models on the Hub
    hf models ls

    # list models with a search query
    hf models ls --search "llama"

    # get info about a model
    hf models info Lightricks/LTX-2
    N)	Annotatedget_args)CLIErrorRepositoryNotFoundErrorRevisionNotFoundError)ExpandModelProperty_TModelSort_T   )	AuthorOpt	FilterOptFormatWithAutoOptLimitOptRevisionOpt	SearchOptTokenOptapi_object_to_dict
get_hf_apimake_expand_properties_parsertyper_factory)OutputFormatWithAutooutModelSortEnumc                     i | ]}||S  r   ).0ss     d/lsinfo/ai/hellotax_ai/base_platform/venv/lib/python3.11/site-packages/huggingface_hub/cli/models.py
<dictcomp>r   5   s    +H+H+HQAq+H+H+H    )typezComma-separated properties to return. When used, only the listed properties (and id) are returned. Example: '--expand=downloads,likes,tags'. Valid: z, .)helpcallbackz Interact with models on the Hub.)r"   z	list | ls)z(hf models ls --sort downloads --limit 10z1hf models ls --search "llama" --author meta-llamaz:hf models ls --num-parameters min:6B,max:128B --sort likes)examples
   searchauthorfilternum_parametersz2Filter by parameter count, e.g. 'min:6B,max:128B'.sortzSort results.limitexpandformattokenreturnc	           
          t          |          }	|r|j        nd}
d |	                    ||| ||
||          D             }t          j        |           dS )zList models on the Hub.r.   Nc                 ,    g | ]}t          |          S r   )r   )r   
model_infos     r   
<listcomp>zmodels_ls.<locals>.<listcomp>`   s0        	:&&  r   )r(   r'   r&   r)   r*   r+   r,   )r   valuelist_modelsr   table)r&   r'   r(   r)   r*   r+   r,   r-   r.   apisort_keyresultss               r   	models_lsr;   D   s    4 5
!
!
!C!+tzztH //) * 
 
  G Igr   infoz/hf models info meta-llama/Llama-3.2-1B-Instructz<hf models info Qwen/Qwen3.5-9B --expand downloads,likes,tagsmodel_idz)The model ID (e.g. `username/repo-name`).revisionc                    t          |          }	 |                    | ||          }nJ# t          $ r}t          d|  d          |d}~wt          $ r}t          d| d|  d          |d}~ww xY wt          j        |           dS )	z"Get info about a model on the Hub.r1   )repo_idr>   r,   zModel 'z' not found.Nz
Revision 'z' not found on 'z'.)r   r3   r   r   r   r   dict)r=   r>   r,   r-   r.   r8   r<   es           r   models_inforC   o   s     5
!
!
!CS~~h&~QQ" @ @ @777788a?  S S SJHJJhJJJKKQRRSHTNNNNNs    + 
A2A		A2A--A2)+__doc__enumtypingr   r   typerhuggingface_hub.errorsr   r   r   huggingface_hub.hf_apir   r	   
_cli_utilsr   r   r   r   r   r   r   r   r   r   r   _outputr   r   sorted_EXPAND_PROPERTIES_SORT_OPTIONSEnumstrr   Optionjoin	ExpandOpt
models_clicommandautor;   ArgumentrC   r   r   r   <module>rX      s     & & & & & & & &  [ [ [ [ [ [ [ [ [ [ E E E E E E E E                          / . . . . . . . VHH%:;;<< %%	/+H+H-+H+H+HsSSS $JEL E  ei  en  en  oA  eB  eB  E  E  E../ABB  	 ] BCCC
        	 	 4 9        d
NOOO	Q	  /***	,           
!       F 
9F    ! 4 9 ^U^1\]]]]^  	
  
     r   