
    g+                     B   U d Z ddlZddlZddlZddlZddlZddlmZm	Z	 ddl
mZmZ ej                  j                         d   j                  d      Zeed<   i Zi ddhd	d	hd
d
hddhddhddhddhddhddhddhddhddhddhddhddhddddhZej+                         D ]1  \  ZZdee<   eD ]"  Z	 ej2                  j                  e      ee<    1 3 dedefd Zdedefd!Zdefd"Zdefd#Zdefd$Z defd%Z!defd&Z"defd'Z#defd(Z$defd)Z%defd*Z&defd+Z'defd,Z(defd-Z)defd.Z*defd/Z+defd0Z,defd1Z-defd2Z.defd3Z/defd4Z0defd5Z1defd6Z2defd7Z3defd8Z4defd9Z5defd:Z6defd;Z7defd<Z8defd=Z9defd>Z:defd?Z;defd@Z<defdAZ=defdBZ>defdCZ?defdDZ@	 dE e eA             v ZBdefdGZDdefdHZEdefdIZFde	eef   fdJZGy# ej2                  j4                  $ r Y Sw xY w# eC$ r dFZBY Gw xY w)Kz0Check presence of installed packages at runtime.    N)AnyDict   )__version__	constants+_PY_VERSIONaiohttpfastaifastapifastcoregradiographvizhf_transferjinjaJinja2kerasnumpypillowPillowpydanticpydotsafetensorstensorboardtensorboardX
tensorflow)
r   ztensorflow-cpuztensorflow-gpuz
tf-nightlyztf-nightly-cpuztf-nightly-gpuzintel-tensorflowzintel-tensorflow-avx512ztensorflow-rocmztensorflow-macostorchN/Apackage_namereturnc                 .    t         j                  | d      S Nr   )_package_versionsgetr   s    S/var/www/openai/venv/lib/python3.12/site-packages/huggingface_hub/utils/_runtime.py_get_versionr'   I   s      u55    c                     t        |       dk7  S r"   r'   r%   s    r&   is_package_availabler+   M   s    %..r(   c                      t         S N)r	    r(   r&   get_python_versionr/   R       r(   c                      t         S r-   )r   r.   r(   r&   get_hf_hub_versionr2   W   r0   r(   c                      t        d      S Nr
   r+   r.   r(   r&   is_aiohttp_availabler6   \       	**r(   c                      t        d      S r4   r*   r.   r(   r&   get_aiohttp_versionr9   `       	""r(   c                      t        d      S Nr   r5   r.   r(   r&   is_fastai_availabler=   e       ))r(   c                      t        d      S r<   r*   r.   r(   r&   get_fastai_versionr@   i       !!r(   c                      t        d      S Nr   r5   r.   r(   r&   is_fastapi_availablerD   n   r7   r(   c                      t        d      S rC   r*   r.   r(   r&   get_fastapi_versionrF   r   r:   r(   c                      t        d      S Nr   r5   r.   r(   r&   is_fastcore_availablerI   w       
++r(   c                      t        d      S rH   r*   r.   r(   r&   get_fastcore_versionrL   {       
##r(   c                      t        d      S Nr   r5   r.   r(   r&   is_gradio_availablerP      r>   r(   c                      t        d      S rO   r*   r.   r(   r&   get_gradio_versionrR      rA   r(   c                      t        d      S Nr   r5   r.   r(   r&   is_graphviz_availablerU      rJ   r(   c                      t        d      S rT   r*   r.   r(   r&   get_graphviz_versionrW      rM   r(   c                      t        d      S Nr   r5   r.   r(   r&   is_hf_transfer_availablerZ          ..r(   c                      t        d      S rY   r*   r.   r(   r&   get_hf_transfer_versionr]          &&r(   c                      t        d      S Nr   r5   r.   r(   r&   is_keras_availablera          ((r(   c                      t        d      S r`   r*   r.   r(   r&   get_keras_versionrd            r(   c                      t        d      S Nr   r5   r.   r(   r&   is_numpy_availablerh      rb   r(   c                      t        d      S rg   r*   r.   r(   r&   get_numpy_versionrj      re   r(   c                      t        d      S Nr   r5   r.   r(   r&   is_jinja_availablerm      rb   r(   c                      t        d      S rl   r*   r.   r(   r&   get_jinja_versionro      re   r(   c                      t        d      S Nr   r5   r.   r(   r&   is_pillow_availablerr      r>   r(   c                      t        d      S rq   r*   r.   r(   r&   get_pillow_versionrt      rA   r(   c                  r    t        d      sy	 ddlm}  y# t        $ r t	        j
                  d       Y yw xY w)Nr   Fr   	validatorzPydantic is installed but cannot be imported. Please check your installation. `huggingface_hub` will default to not using Pydantic. Error message: '{e}'T)r+   r   rw   ImportErrorwarningswarnrv   s    r&   is_pydantic_availabler{      sB    
+&   B	
 s    66c                      t        d      S )Nr   r*   r.   r(   r&   get_pydantic_versionr}      rM   r(   c                      t        d      S Nr   r5   r.   r(   r&   is_pydot_availabler      rb   r(   c                      t        d      S r   r*   r.   r(   r&   get_pydot_versionr      re   r(   c                      t        d      S Nr   r5   r.   r(   r&   is_tensorboard_availabler      r[   r(   c                      t        d      S r   r*   r.   r(   r&   get_tensorboard_versionr      r^   r(   c                      t        d      S Nr   r5   r.   r(   r&   is_tf_availabler      s    --r(   c                      t        d      S r   r*   r.   r(   r&   get_tf_versionr      s    %%r(   c                      t        d      S Nr   r5   r.   r(   r&   is_torch_availabler      rb   r(   c                      t        d      S r   r*   r.   r(   r&   get_torch_versionr      re   r(   c                      t        d      S )Nr   r5   r.   r(   r&   is_safetensors_availabler      r[   r(   zgoogle.colabFc                      	 t               j                  } | j                  D ]  }|j                  dk(  s y y# t        $ r Y yw xY w)zReturn `True` if code is executed in a notebook (Jupyter, Colab, QTconsole).

    Taken from https://stackoverflow.com/a/39662359.
    Adapted to make it work with Google colab as well.
    ZMQInteractiveShellTF)get_ipython	__class____mro____name__	NameError)shell_classparent_classs     r&   is_notebookr     sM    !m--'//L$$(== 0  s   29 9 9 	AAc                      t         S )zoReturn `True` if code is executed in a Google colab.

    Taken from https://stackoverflow.com/a/63519730.
    )_is_google_colabr.   r(   r&   is_google_colabr      s
    
 r(   c                  F    t         j                  j                  d      dk(  S )zKReturn `True` if code is executed in a Google Colab Enterprise environment.VERTEX_PRODUCTCOLAB_ENTERPRISE)osenvironr$   r.   r(   r&   is_colab_enterpriser   (  s    ::>>*+/AAAr(   c                  T   ddl m} m} ddlm}  |        }t               t        j                         t               d}	 t               j                  }d|d<   |j                  |d<   t               rdnd|d	<   t               rdnd|d
<   t               rdnd|d<   t        j                   |d<   |du|d<   |	  |       d   |d<   	 dj%                   |             |d<   t'               |d<   t)               |d<   t+               |d<   t-               |d<   t/               |d<   t1               |d<   t3               |d<   t5               |d<   t7               |d<   t9               |d<   t;               |d<   t=               |d<   t?               |d<   tA               |d <   t        jB                  |d!<   t        jD                  |d"<   t        jF                  |d#<   t        j                   |d$<   t        jH                  |d%<   t        jJ                  |d&<   t        jL                  |d'<   t        jN                  |d(<   t        jP                  |d)<   t        jR                  |d*<   t        jT                  |d+<   t        jV                  |d,<   t        jX                  |d-<   t        jZ                  |d.<   t]        d/       t]        d0j%                  |j_                         D cg c]  \  }}d1| d2|  c}}      d0z          |S # t        $ r	 d|d<   Y w xY w# t"        $ r Y Lw xY w# t"        $ r Y Bw xY wc c}}w )3a  Dump information about the machine to help debugging issues.

    Similar helper exist in:
    - `datasets` (https://github.com/huggingface/datasets/blob/main/src/datasets/commands/env.py)
    - `diffusers` (https://github.com/huggingface/diffusers/blob/main/src/diffusers/commands/env.py)
    - `transformers` (https://github.com/huggingface/transformers/blob/main/src/transformers/commands/env.py)
    r   )	get_tokenwhoami)list_credential_helpers)zhuggingface_hub versionPlatformzPython versionYeszRunning in iPython ?ziPython shellNozRunning in notebook ?zRunning in Google Colab ?z$Running in Google Colab Enterprise ?zToken path ?NzHas saved token ?namez
Who am I ?z, z!Configured git credential helpersFastAI
TensorflowTorchr   Graphvizr   Pydotr   r   r   r   r   r   r
   ENDPOINTHF_HUB_CACHEHF_ASSETS_CACHEHF_TOKEN_PATHHF_STORED_TOKENS_PATHHF_HUB_OFFLINEHF_HUB_DISABLE_TELEMETRYHF_HUB_DISABLE_PROGRESS_BARSHF_HUB_DISABLE_SYMLINKS_WARNING#HF_HUB_DISABLE_EXPERIMENTAL_WARNINGHF_HUB_DISABLE_IMPLICIT_TOKENHF_HUB_ENABLE_HF_TRANSFERHF_HUB_ETAG_TIMEOUTHF_HUB_DOWNLOAD_TIMEOUTz5
Copy-and-paste the text below in your GitHub issue.

z- z: )0huggingface_hubr   r   huggingface_hub.utilsr   r2   platformr/   r   r   r   r   r   r   r   r   r   	Exceptionjoinr@   r   r   ro   rW   rd   r   rt   r]   rR   r   rj   r}   r9   r   r   r   r   r   r   r   r   r   r   r   r   r   printitems)r   r   r   tokeninfor   propvals           r&   dump_environment_infor   -  s    2=KE $6#7%%',.D,!m--',#$ + 4 4_ .9]ED	 !1@1BD	$%<O<Q5W[D	/0$22D %T 1D		!'&!1D48II>U>W4X01
 ()DN')D%'DM&(DN+-D%'DM%'DM')DN13D')DN13D%'DM+-D)+DO !))D$11D'77D	%33D$-$C$CD	 !&55D	'0'I'ID	#$+4+Q+QD	'(.7.W.WD	*+2;2_2_D	./,5,S,SD	()(1(K(KD	$%"+"?"?D	&/&G&GD	"#	
CD	$))FID#r$r#'F
G$
NOKk  ,'+#$,  		
  H Gs;   (K/ 7L L L$/L L	LL	L! L!)H__doc__importlib.metadata	importlibr   r   sysry   typingr   r    r   r   versionsplitrstripr	   str__annotations__r#   _CANDIDATESr   candidate_namepackage_namesr   metadataPackageNotFoundErrorr'   boolr+   r/   r2   r6   r9   r=   r@   rD   rF   rI   rL   rP   rR   rU   rW   rZ   r]   ra   rd   rh   rj   rm   ro   rr   rt   r{   r}   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r.   r(   r&   <module>r      s   7  	  
   % ;;$$&q)005S 5 	{xj 	{ 	
 xj  M? hZ gY gY xj  gY M? N#   !8 gY9@ &1%6%6%8!NM(-n%	090B0B0J0J40Pn-  &96s 6s 6/s /t /
C 
C 
+d +#S #
*T *"C "
+d +#S #
,t ,$c $
*T *"C "
,t ,$c $
/$ /' '
)D )!3 !
)D )!3 !
)D )!3 !
*T *"C "
t 0$c $
)D )!3 !
/$ /' '
. .& &
)D )!3 !
/$ /
 &[]);;
T   BT B
NtCH~ NQ !!66 		N  s$   G4H 4HHHH