
    g                         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             dS dS )    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	                      }n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     ]/var/www/html/ai-engine/env/lib/python3.11/site-packages/accelerate/commands/config/config.pyget_user_inputr      sO    &7	12$ 
 0AAA$&&"$$M    c                     | |                      dt                    }nt          j        dt                    }|                    dd d           | |                    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"   ,   s    &&x[&II()DR]^^^
"	  	 	 	 000Mr   c                 l   t                      }| j        | j        }nDt          j                            t
                    st          j        t
                     t          }|                    d          r|	                    |           n|
                    |           t          d|            d S )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#&w}}Y'' 	#K	""".G$$ )K((((K(((	
<{
<
<=====r   c                  h    t                      } |                                 }t          |           d S N)r"   
parse_argsr   )r!   r-   s     r   mainr1   R   s2    "$$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:      s   "  				 / / / / / / & & & & & & h h h h h h h h h h h h P P P P P P P P P P * * * * * * p
 
 
   ,> > >    zDFFFFF r   