o
    di	                     @   s\   d dl Z d dlZd dlmZ d dlmZmZ ddlmZ ddl	m
Z
mZ G dd de
ZdS )	    N)__version__)is_tf_availableis_torch_available      )BaseOptimumCLICommandCommandInfoc                   @   s,   e Zd ZedddZedd Zdd ZdS )	EnvironmentCommandenvz+Get information about the environment used.)namehelpc                 C   s   d dd |  D d S )N
c                 S   s    g | ]\}}d | d| qS )z- z:  ).0propvalr   r   b/lsinfo/ai/hellotax_ai/llm_service/venv_embed/lib/python3.10/site-packages/optimum/commands/env.py
<listcomp>   s     z2EnvironmentCommand.format_dict.<locals>.<listcomp>)joinitems)dr   r   r   format_dict   s   zEnvironmentCommand.format_dictc              
   C   s   d}d}t  rdd l}|j}|j }d}d}t r:dd l}|j}z|j }W n t	y9   t
|jd}Y nw ttt t tj| d| d| d| dd}td t| | |S )	Nznot installedNAr   GPUz (cuda availabe: ))z`optimum` versionz`transformers` versionPlatformzPython versionzHuggingface_hub versionzPyTorch version (GPU?)zTensorflow version (GPU?)z5
Copy-and-paste the text below in your GitHub issue:
)r   torchr   cudais_availabler   
tensorflowtestis_gpu_availableAttributeErrorboolconfiglist_physical_devicesversiontransformers_versionplatformpython_versionhuggingface_hubprintr   )self
pt_versionpt_cuda_availabler   
tf_versiontf_cuda_availabletfinfor   r   r   run    s6   

zEnvironmentCommand.runN)__name__
__module____qualname__r   COMMANDstaticmethodr   r3   r   r   r   r   r	      s
    
r	   )r(   r*   transformersr   r'   transformers.utilsr   r   r&    r   r   r	   r   r   r   r   <module>   s   