o
    Zhc*                  
   @   s  U d 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 d 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 D ]#\ZZdee< eD ]Zzejeee< W  n ejjy   Y qw q|dedefd d!Zdedefd"d#Zdefd$d%Zdefd&d'Zdefd(d)Zdefd*d+Z defd,d-Z!defd.d/Z"defd0d1Z#defd2d3Z$defd4d5Z%defd6d7Z&defd8d9Z'defd:d;Z(defd<d=Z)defd>d?Z*defd@dAZ+defdBdCZ,defdDdEZ-defdFdGZ.defdHdIZ/defdJdKZ0defdLdMZ1defdNdOZ2defdPdQZ3defdRdSZ4defdTdUZ5defdVdWZ6defdXdYZ7defdZd[Z8defd\d]Z9defd^d_Z:defd`daZ;defdbdcZ<defdddeZ=defdfdgZ>defdhdiZ?z	djee@ v ZAW n eBy   dkZAY nw defdldmZCdefdndoZDdeeef fdpdqZEdS )rz0Check presence of installed packages at runtime.    N)AnyDict   )__version__	constants+_PY_VERSIONaiohttpfastaifastcoregradiographvizhf_transferjinjaJinja2keras	minijinjanumpypillowPillowpydanticpydotsafetensorstensorboardZ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                 C   s   t | dS Nr   )_package_versionsgetr    r#   U/var/www/html/lang_env/lib/python3.10/site-packages/huggingface_hub/utils/_runtime.py_get_versionH      r%   c                 C   s   t | dkS r   r%   r"   r#   r#   r$   is_package_availableL   r&   r(   c                   C      t S N)r   r#   r#   r#   r$   get_python_versionQ      r+   c                   C   r)   r*   )r   r#   r#   r#   r$   get_hf_hub_versionV   r,   r-   c                   C      t dS Nr	   r(   r#   r#   r#   r$   is_aiohttp_available[      r1   c                   C   r.   r/   r'   r#   r#   r#   r$   get_aiohttp_version_   r2   r3   c                   C   r.   Nr
   r0   r#   r#   r#   r$   is_fastai_availabled   r2   r5   c                   C   r.   r4   r'   r#   r#   r#   r$   get_fastai_versionh   r2   r6   c                   C   r.   Nr   r0   r#   r#   r#   r$   is_fastcore_availablem   r2   r8   c                   C   r.   r7   r'   r#   r#   r#   r$   get_fastcore_versionq   r2   r9   c                   C   r.   Nr   r0   r#   r#   r#   r$   is_gradio_availablev   r2   r;   c                   C   r.   r:   r'   r#   r#   r#   r$   get_gradio_versionz   r2   r<   c                   C   r.   Nr   r0   r#   r#   r#   r$   is_graphviz_available   r2   r>   c                   C   r.   r=   r'   r#   r#   r#   r$   get_graphviz_version   r2   r?   c                   C   r.   Nr   r0   r#   r#   r#   r$   is_hf_transfer_available   r2   rA   c                   C   r.   r@   r'   r#   r#   r#   r$   get_hf_transfer_version   r2   rB   c                   C   r.   Nr   r0   r#   r#   r#   r$   is_keras_available   r2   rD   c                   C   r.   rC   r'   r#   r#   r#   r$   get_keras_version   r2   rE   c                   C   r.   Nr   r0   r#   r#   r#   r$   is_minijinja_available   r2   rG   c                   C   r.   rF   r'   r#   r#   r#   r$   get_minijinja_version   r2   rH   c                   C   r.   Nr   r0   r#   r#   r#   r$   is_numpy_available   r2   rJ   c                   C   r.   rI   r'   r#   r#   r#   r$   get_numpy_version   r2   rK   c                   C   r.   Nr   r0   r#   r#   r#   r$   is_jinja_available   r2   rM   c                   C   r.   rL   r'   r#   r#   r#   r$   get_jinja_version   r2   rN   c                   C   r.   Nr   r0   r#   r#   r#   r$   is_pillow_available   r2   rP   c                   C   r.   rO   r'   r#   r#   r#   r$   get_pillow_version   r2   rQ   c                  C   s>   t dsdS z	ddlm}  W dS  ty   td Y dS 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   rS   ImportErrorwarningswarnrR   r#   r#   r$   is_pydantic_available   s   
rW   c                   C   r.   )Nr   r'   r#   r#   r#   r$   get_pydantic_version   r2   rX   c                   C   r.   Nr   r0   r#   r#   r#   r$   is_pydot_available   r2   rZ   c                   C   r.   rY   r'   r#   r#   r#   r$   get_pydot_version   r2   r[   c                   C   r.   Nr   r0   r#   r#   r#   r$   is_tensorboard_available   r2   r]   c                   C   r.   r\   r'   r#   r#   r#   r$   get_tensorboard_version   r2   r^   c                   C   r.   Nr   r0   r#   r#   r#   r$   is_tf_available   r2   r`   c                   C   r.   r_   r'   r#   r#   r#   r$   get_tf_version   r2   ra   c                   C   r.   Nr   r0   r#   r#   r#   r$   is_torch_available   r2   rc   c                   C   r.   rb   r'   r#   r#   r#   r$   get_torch_version   r2   rd   c                   C   r.   )Nr   r0   r#   r#   r#   r$   is_safetensors_available   r2   re   zgoogle.colabFc                  C   sB   zt  j} | jD ]}|jdkr W dS qW dS  ty    Y dS 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_classZparent_classr#   r#   r$   is_notebook  s   

rm   c                   C   r)   )zoReturn `True` if code is executed in a Google colab.

    Taken from https://stackoverflow.com/a/63519730.
    )_is_google_colabr#   r#   r#   r$   is_google_colab  s   ro   c                  C   s:  ddl m} m} ddlm} |  }t t t d}zt j	}d|d< |j
|d< W n ty7   d|d< Y nw t r=dnd|d	< t rFdnd|d
< tj|d< |du|d< |durlz	| d |d< W n	 tyk   Y nw z
d| |d< W n	 ty   Y nw t |d< t |d< t |d< t |d< t |d< t |d< t |d< t |d< t |d< t |d< t |d< t |d< t |d< t |d< tj |d < tj!|d!< tj"|d"< tj|d#< tj#|d$< tj$|d%< tj%|d&< tj&|d'< tj'|d(< tj(|d)< tj)|d*< tj*|d+< tj+|d,< t,d- t,d.d/d0 |- D d.  |S )1a  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 versionZYeszRunning in iPython ?ziPython shellZNozRunning in notebook ?zRunning in Google Colab ?zToken path ?NzHas saved token ?namez
Who am I ?z, z!Configured git credential helpersZFastAIZ
TensorflowZTorchr   Graphvizr   ZPydotr   r   r   r   r   r   r	   ENDPOINTHF_HUB_CACHEHF_ASSETS_CACHEHF_TOKEN_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.

c                 S   s    g | ]\}}d | d| qS )z- z: r#   ).0propvalr#   r#   r$   
<listcomp>s  s     z)dump_environment_info.<locals>.<listcomp>).Zhuggingface_hubrp   rq   Zhuggingface_hub.utilsrr   r-   platformr+   rg   rh   rj   rk   rm   ro   r   ry   	Exceptionjoinr6   ra   rd   rN   r?   rE   r[   rQ   rB   r<   r^   rK   rX   r3   rv   rw   rx   rz   r{   r|   r}   r~   r   r   r   r   printitems)rp   rq   rr   tokeninforl   r#   r#   r$   dump_environment_info'  sv   



























 r   )F__doc__importlib.metadata	importlibr   sysrU   typingr   r    r   r   versionsplitrstripr   str__annotations__r    Z_CANDIDATESr   Zcandidate_nameZpackage_namesrt   metadataZPackageNotFoundErrorr%   boolr(   r+   r-   r1   r3   r5   r6   r8   r9   r;   r<   r>   r?   rA   rB   rD   rE   rG   rH   rJ   rK   rM   rN   rP   rQ   rW   rX   rZ   r[   r]   r^   r`   ra   rc   rd   re   rg   rn   rk   rm   ro   r   r#   r#   r#   r$   <module>   s   	
 