
    Y j6              '       n	   S 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
Jr  SSKJr  \" S	S
9r\" SS
9r\\\R"                  " SS
94   r\\S-  \R&                  " SS
94   r\\S-  \R&                  " SS
94   r\R-                  SSS/S9  SUS\S\	SS4S jj5       r\R-                  SS/S9SSSSSSSSS.S\S\\\R&                  " SS
94   S\\\R&                  " SS
94   S\\\R&                  " S S
94   S!\\\R&                  " S"S
94   S#\\\R&                  " S$S
94   S%\\\R&                  " S&S
94   S'\\\R&                  " S(S
94   S\S)\\S-  \R&                  " S*S
94   S\	S+\\\R&                  " S,S
94   S-\\\R&                  " S.S
94   S/\\S-  \R&                  " S0S
94   S1\\S-  \R&                  " S2S
94   S3\\S-  \R&                  " S4S
94   SS4"S5 jj5       r\R-                  SS6/S9    SVS\\\R&                  " SS
94   S\S\\S-  \R&                  " S7S
94   S\S\	SS4S8 jj5       r SWS\	SS4S9 jjr\R-                  SS:/S9" \5        \R-                  S;S<S=9" \5        \R;                  \S>S?9  \R-                  S@/S9  SUS\S\S\	SS4SA jj5       r\R-                  SB/S9              SXS\S\S\\S-  \R&                  " SS
94   S\\S-  \R&                  " S S
94   S!\\S-  \R&                  " S"S
94   S#\\S-  \R&                  " S$S
94   S\\S-  \R&                  " SCS
94   SD\\S-  \R&                  " SES
94   S)\\S-  \R&                  " S*S
94   S+\\S-  \R&                  " S,S
94   S-\\S-  \R&                  " S.S
94   S/\\S-  \R&                  " S0S
94   S1\\S-  \R&                  " S2S
94   S3\\S-  \R&                  " S4S
94   S\	SS4 SF jj5       r\R-                  SG/S9   SYS\S\SH\\ \R&                  " SISJS
94   S\	SS4
SK jj5       r!\R-                  SL/S9  SUS\S\S\	SS4SM jj5       r"\R-                  SN/S9   SYS\S\SO\\ \R&                  " SPSQS
94   S\	SS4
SR jj5       r#\R-                  SS/S9  SUS\S\S\	SS4ST jj5       r$g)Zz2CLI commands for Hugging Face Inference Endpoints.    )	AnnotatedN)InferenceEndpointScalingMetric)HfHubHTTPError   )TokenOpt
get_hf_apityper_factory)outz(Manage Hugging Face Inference Endpoints.)helpz.Interact with the Inference Endpoints catalog.zEndpoint name.z_The namespace associated with the Inference Endpoint. Defaults to the current user's namespace.z	list | lszhf endpoints lsz"hf endpoints ls --namespace my-org)examples	namespacetokenreturnc                 @   [        US9n UR                  XS9n/ nU GH  nUR                  nUR                  S0 5      nUR                  S0 5      n	UR                  S0 5      n
UR                  S	0 5      nUR                  UR                  S
S5      [        U	[        5      (       a  U	R                  SS5      OS[        U[        5      (       a  UR                  SS5      OS[        U	[        5      (       a  U	R                  SS5      OS[        U	[        5      (       a  U	R                  SS5      OS[        U
[        5      (       a  U
R                  SS5      OS[        U[        5      (       a  UR                  SS5      OS[        U[        5      (       a  UR                  SS5      OSS.5        GM     [        R                  " US
S9  g! [         aG  n[        R                  " SU 35        [
        R                  " UR                  R                  S9UeSnAff = f)z6Lists all Inference Endpoints for the given namespace.r   )r   r   zListing failed: codeNstatusmodelcomputeprovidername 
repositorystatetask	frameworkinstanceTypevendorregion)r   r   r   r   r   instancer   r    )id_key)r   list_inference_endpointsr   r
   errortyperExitresponsestatus_coderawgetappend
isinstancedicttable)r   r   api	endpointsr$   resultsendpointr)   r   r   r   r   s               x/root/GenerationalWealth/GenerationalWealth/venv/lib/python3.13/site-packages/huggingface_hub/cli/inference_endpoints.pylsr4   $   s    5
!CE0090R	
 Gll2&$'')R(77:r*+8B5$8O8O<4UW5?5M5M&**Wb1SU1;E41H1H		&"-b;EeT;R;RUYY{B7XZ?I'SW?X?XGKK;^`8B8T8R8R(,,x4XZ8B8T8R8R(,,x4XZ		
 $ IIgf%/  E		$UG,-jjenn889uDEs   G 
HAHHdeployzChf endpoints deploy my-endpoint --repo gpt2 --framework pytorch ...)r   r   )r   r   r   min_replicamax_replicascale_to_zero_timeoutscaling_metricscaling_thresholdr   repozeThe name of the model repository associated with the Inference Endpoint (e.g. 'openai/gpt-oss-120b').r   z@The machine learning framework used for the model (e.g. 'vllm').acceleratorz?The hardware accelerator to be used for inference (e.g. 'cpu').instance_sizezNThe size or type of the instance to be used for hosting the model (e.g. 'x4').instance_typezYThe cloud instance type where the Inference Endpoint will be deployed (e.g. 'intel-icl').r    zTThe cloud region in which the Inference Endpoint will be created (e.g. 'us-east-1').r   zVThe cloud provider or vendor where the Inference Endpoint will be hosted (e.g. 'aws').r   zCThe task on which to deploy the model (e.g. 'text-classification').r6   zVThe minimum number of replicas (instances) to keep running for the Inference Endpoint.r7   zRThe maximum number of replicas (instances) to scale to for the Inference Endpoint.r8   zFThe duration in minutes before an inactive endpoint is scaled to zero.r9   z!The metric reference for scaling.r:   zeThe scaling metric threshold used to trigger a scale up. Ignored when scaling metric is not provided.c                    [        U
S9nUR                  U UUUUUUUUU	U
UUUUUS9n[        R                  " UR                  5        g)z3Deploy an Inference Endpoint from a Hub repository.r   )r   r   r   r<   r=   r>   r    r   r   r   r   r6   r7   r9   r:   r8   N)r   create_inference_endpointr
   r-   r)   )r   r;   r   r<   r=   r>   r    r   r   r   r   r6   r7   r8   r9   r:   r/   r2   s                     r3   r5   r5   G   sf    l 5
!C,,##%+3! - H$ HHX\\    zChf endpoints catalog deploy --repo meta-llama/Llama-3.2-1B-InstructzPThe hardware accelerator to be used for inference (e.g. 'cpu', 'gpu', 'neuron').c                 &   [        US9n UR                  U UUUUS9n[        R                  " UR                  5        g! [         aG  n[        R                  " SU 35        [
        R                  " UR                  R                  S9UeSnAff = f)z4Deploy an Inference Endpoint from the Model Catalog.r   )repo_idr   r<   r   r   zDeployment failed: r   N)r   &create_inference_endpoint_from_catalogr   r
   r$   r%   r&   r'   r(   r-   r)   )r;   r   r<   r   r   r/   r2   r$   s           r3   deploy_from_catalogrE      s    & 5
!C
E==# > 
 HHX\\	  E		'w/0jjenn889uDEs   ? 
B	ABBc                    [        U S9n UR                  U S9n[        R                  " SU05        g! [         aG  n[        R                  " SU 35        [
        R                  " UR                  R                  S9UeSnAff = f)zList available Catalog models.r   zCatalog fetch failed: r   Nmodels)
r   list_inference_catalogr   r
   r$   r%   r&   r'   r(   r-   )r   r/   rG   r$   s       r3   list_catalogrI      s}     5
!CE++%+8
 HHh 	  E		*5'23jjenn889uDEs   3 
BAA??Bzhf endpoints catalog lszlist-catalogT)r   hiddencatalogr   z!hf endpoints describe my-endpointc                     [        US9n UR                  XUS9n[        R                  " UR                  5        g! [         aG  n[        R                  " SU 35        [
        R                  " UR                  R                  S9UeSnAff = f)z+Get information about an existing endpoint.r   r   r   r   zFetch failed: r   N)r   get_inference_endpointr   r
   r$   r%   r&   r'   r(   r-   r)   r   r   r   r/   r2   r$   s         r3   describerQ      s~     5
!CE--4TY-Z
 HHX\\	  E		N5'*+jjenn889uDE   < 
BABBz/hf endpoints update my-endpoint --min-replica 2zBThe machine learning framework used for the model (e.g. 'custom').revisionzrThe specific model revision to deploy on the Inference Endpoint (e.g. '6c0e6080953db56375760c0471a8c5f2929baf11').c                 :   [        US9n UR                  U UUUUUUUUU	U
UUUUS9n[        R                  " UR                  5        g! [         aG  n[        R                  " SU 35        [
        R                  " UR                  R                  S9UeSnAff = f)zUpdate an existing endpoint.r   )r   r   r   r   rS   r   r<   r=   r>   r6   r7   r8   r9   r:   r   zUpdate failed: r   N)r   update_inference_endpointr   r
   r$   r%   r&   r'   r(   r-   r)   )r   r   r;   r<   r=   r>   r   rS   r   r6   r7   r8   r9   r:   r   r/   r2   r$   s                     r3   updaterV      s    ^ 5
!CE00#''##"7)/ 1 
( HHX\\  E		OE7+,jjenn889uDEs   A	 	
BABBzhf endpoints delete my-endpointyesz--yeszSkip confirmation prompts.c                 D   [         R                  " SU  S3US9  [        US9n UR                  XUS9  [         R                  " S	U  S
3U S9  g! [         aG  n[         R
                  " SU 35        [        R                  " UR                  R                  S9UeSnAff = f)z)Delete an Inference Endpoint permanently.zDelete endpoint 'z'?)rW   r   rN   zDelete failed: r   Nz	Deleted 'z'.rL   )r
   confirmr   delete_inference_endpointr   r$   r%   r&   r'   r(   result)r   r   rW   r   r/   r$   s         r3   deleter\   d  s     KK#D6,#6
5
!CE%%4E%R
 JJ4&#$/	  E		OE7+,jjenn889uDEs   A 
BABBzhf endpoints pause my-endpointc                     [        US9n UR                  XUS9n[        R                  " UR                  5        g! [         aG  n[        R                  " SU 35        [
        R                  " UR                  R                  S9UeSnAff = f)zPause an Inference Endpoint.r   rN   zPause failed: r   N)r   pause_inference_endpointr   r
   r$   r%   r&   r'   r(   r-   r)   rP   s         r3   pauser_   {  s~     5
!CE//TV[/\
 HHX\\	  E		N5'*+jjenn889uDErR   zhf endpoints resume my-endpointfail_if_already_runningz--fail-if-already-runningzWIf `True`, the method will raise an error if the Inference Endpoint is already running.c                 .   [        US9n UR                  U UUU(       + S9n[        R                  " UR                  5        g! [         aG  n[        R                  " SU 35        [
        R                  " UR                  R                  S9UeSnAff = f)zResume an Inference Endpoint.r   )r   r   r   
running_okzResume failed: r   N)r   resume_inference_endpointr   r
   r$   r%   r&   r'   r(   r-   r)   )r   r   r`   r   r/   r2   r$   s          r3   resumerd     s     5
!C	E0022	 1 
 HHX\\  E		OE7+,jjenn889uDEs   A 
BABBz&hf endpoints scale-to-zero my-endpointc                     [        US9n UR                  XUS9n[        R                  " UR                  5        g! [         aG  n[        R                  " SU 35        [
        R                  " UR                  R                  S9UeSnAff = f)z$Scale an Inference Endpoint to zero.r   rN   zScale To Zero failed: r   N)r    scale_to_zero_inference_endpointr   r
   r$   r%   r&   r'   r(   r-   r)   rP   s         r3   scale_to_zerorg     s     5
!CE77T^c7d
 HHX\\	  E		*5'23jjenn889uDErR   )NN)NNNN)N)NNNNNNNNNNNNNN)NFN)%__doc__typingr   r%   $huggingface_hub._inference_endpointsr   huggingface_hub.errorsr   
_cli_utilsr   r   r	   _outputr
   ie_clicatalog_appstrArgumentNameArgOptionNameOptNamespaceOptcommandr4   intfloatr5   rE   rI   	add_typerrQ   rV   boolr\   r_   rd   rg    rA   r3   <module>r|      s.	   8   O 1 ; ;  
F	G!QR 	NN()+ $J	LL&')
 $J	LLn '8:^&_`"&&& 
& a&D X)n(op\ # 	 	
 	
 	 	 	eh
h
x	
	h S	
	h R	
	h( a	
	)h4 l	
	5h@ g	
	AhL i	
	MhZ [h\ d
V	
	]hh ihj i	
	khv e	
	whB %d
Y	
	ChN &-4	
	OhZ !x	
	[hf 
gh qhV (.s-tu  	"
x	
	  d
c	
	    
! vF !!	!   0I/J  KL Y N4 0 >   9  - =>? #
  
	 @  KLM # 	 	 	 	 	 	 	 	 	 	 	 	Wd
dd d
x	
	d d
R	
	d d
a	
	d* d
l	
	+d6 d
U	
	7dB d
 F	
	CdN d
V	
	OdZ d
i	
	[df d
e	
	gdr %d
Y	
	sd~ &-4	
	dJ !x	
	KdV WdX 
Yd NdN ;<= # 	0
00 
W#?@	B
0 0 
0 >0, :;< #
  
	 =  ;<= # 	
 ''j	
	  
 >6 BCD #
  
	 ErA   