
    9i                         d dl Z d dlZd dlmZ ddlmZ ddlmZmZm	Z	m
Z
 ddlmZmZmZ ddlmZ dZd	 Zdd
Zd Zd Zedk(  r e        yy)    N)ComputeEnvironment   )get_cluster_input)	cache_dirdefault_config_filedefault_yaml_config_fileload_config_from_file)
_ask_field_ask_options_convert_compute_environment)get_sagemaker_inputzLaunches a series of prompts to create and save a `default_config.yaml` configuration file for your training system. Should always be ran first on your machinec                  ~    t        dddgt              } | t        j                  k(  rt	               }|S t               }|S )Nz-In which compute environment are you running?zThis machinezAWS (Amazon SageMaker))r   r   r   AMAZON_SAGEMAKERr   r   )compute_environmentconfigs     k/var/www/html/backtest/airagagent/rag_env/lib/python3.12/site-packages/accelerate/commands/config/config.pyget_user_inputr      sK    &7	12$
 0AAA$& M #$M    c                     | | j                  dt              }nt        j                  dt              }|j	                  dd d       | |j                  t               |S )Nr   )descriptionzAccelerate config commandz--config_fileaT  The path to use to store the config file. Will default to a file named default_config.yaml in the cache location, which is the content of the environment `HF_HOME` suffixed with 'accelerate', or if you don't have such an environment variable, your cache directory ('~/.cache' or the content of `XDG_CACHE_HOME`) suffixed with 'huggingface'.)defaulthelp)func)
add_parserr   argparseArgumentParseradd_argumentset_defaultsconfig_command)
subparsersparsers     r   config_command_parserr"   ,   sm    &&x[&I(()DR]^
"	  	 0Mr   c                 R   t               }| j                  | j                  }nBt        j                  j	                  t
              st        j                  t
               t        }|j                  d      r|j                  |       n|j                  |       t        d|        y )Nz.jsonz"accelerate configuration saved at )r   config_fileospathisdirr   makedirsr   endswithto_json_fileto_yaml_fileprint)argsr   r$   s      r   r   r   B   s|    F#&&ww}}Y'KK	".G$K(K(	.{m
<=r   c                  N    t               } | j                         }t        |       y N)r"   
parse_argsr   )r!   r-   s     r   mainr1   R   s     "$FD4r   __main__r/   )r   r%   accelerate.utilsr   clusterr   config_argsr   r   r   r	   config_utilsr
   r   r   	sagemakerr   r   r   r"   r   r1   __name__ r   r   <module>r:      sR   "  	 / & h h P P * p
,>  zF r   