a
    d?                     @   s   d dl Z ddlmZmZmZmZmZ ddlmZ g dZ	dddZ
g dd fd	d
Zdd Zdd Zdd Zdd Zdd Zdd ZG dd de jZdS )    N   )ComputeEnvironmentDistributedTypeDynamoBackendPrecisionTypeSageMakerDistributedType   )
BulletMenu)
ZEAGERZ	AOT_EAGERZINDUCTORZNVFUSERZAOT_NVFUSERZAOT_CUDAGRAPHSZOFIZFX2TRTZONNXRTZIPEXc                 C   sj   d}|rft | }z0|d ur,t|dkr,|W S |d ur<||n|W S  tyb   |d ur^t| Y q0 qd S )NTr   )inputlen	Exceptionprint)
input_textconvert_valuedefaulterror_messageZ	ask_againresult r   p/var/www/html/stable-diffusion-webui/venv/lib/python3.9/site-packages/accelerate/commands/config/config_utils.py
_ask_field+   s    r   c                 C   s*   t | |}|j|d}|d ur&||S |S )N)Zdefault_choice)r	   run)r   optionsr   r   menur   r   r   r   _ask_options8   s    
r   c                 C   s   t | } tddg|  S )NZLOCAL_MACHINEZAMAZON_SAGEMAKER)intr   valuer   r   r   _convert_compute_environment>   s    r   c                 C   s   t | } tg d|  S )N)NOZ	MULTI_CPUZ	MULTI_XPUZ	MULTI_GPUZ	MULTI_NPUZTPU)r   r   r   r   r   r   _convert_distributed_modeC   s    r   c                 C   s   t | } tt|  jS )N)r   r   DYNAMO_BACKENDSr   r   r   r   r   _convert_dynamo_backendH   s    r!   c                 C   s   t | } tg d|  S )N)noZfp16Zbf16Zfp8)r   r   r   r   r   r   _convert_mixed_precisionM   s    r#   c                 C   s   t | } tg d|  S )N)r   ZDATA_PARALLELZMODEL_PARALLEL)r   r   r   r   r   r   #_convert_sagemaker_distributed_modeR   s    r$   c                 C   s   ddd|    S )NTF)yesr"   )lowerr   r   r   r   _convert_yes_no_to_boolW   s    r'   c                       s    e Zd ZdZ fddZ  ZS )SubcommandHelpFormatterzc
    A custom formatter that will remove the usage line from the help message for subcommands.
    c                    s"   t  ||||}|dd}|S )Nz<command> [<args>]  )super_format_usagereplace)selfusageactionsgroupsprefix	__class__r   r   r+   `   s    z%SubcommandHelpFormatter._format_usage)__name__
__module____qualname____doc__r+   __classcell__r   r   r2   r   r(   [   s   r(   )NNN)argparseZutils.dataclassesr   r   r   r   r   r   r	   r    r   r   r   r   r!   r#   r$   r'   RawDescriptionHelpFormatterr(   r   r   r   r   <module>   s   
