U
    0-e                     @   s   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	d
 ZdddZdd Zdd Zedkre  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                  C   s,   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   ZAMAZON_SAGEMAKERr   r   )Zcompute_environmentconfig r   b/var/www/html/Darija-Ai-Train/env/lib/python3.8/site-packages/accelerate/commands/config/config.pyget_user_input   s    
r   c                 C   sN   | d k	r| j dtd}ntjdtd}|jdd dd | d k	rJ|jtd |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)Z
subparsersparserr   r   r   config_command_parser,   s    r   c                 C   sd   t  }| jd k	r| j}ntjts.tt t}|drH|	| n
|
| td|  d S )Nz.jsonz"accelerate configuration saved at )r   config_fileospathisdirr   makedirsr   endswithZto_json_fileZto_yaml_fileprint)argsr   r   r   r   r   r   B   s    



r   c                  C   s   t  } |  }t| d S )N)r   
parse_argsr   )r   r$   r   r   r   mainR   s    r&   __main__)N)r   r   Zaccelerate.utilsr   Zclusterr   Zconfig_argsr   r   r   r   Zconfig_utilsr	   r
   r   Z	sagemakerr   r   r   r   r   r&   __name__r   r   r   r   <module>   s   
