U
    0-e[	                     @   sH   d dl mZ ddlmZmZ ddlmZ dZdd Zdd	 Z	d
d Z
dS )    )Path   )default_config_fileload_config_from_file)SubcommandHelpFormatterz`Update an existing config file with the latest defaults while maintaining the old configuration.c                 C   sh   | j }|dkr tt r t}nt| s<td| dt|}|drZ|| n
|| |S )zj
    Update an existing config file with the latest defaults while maintaining the old configuration.
    Nz"The passed config file located at z doesn't exist.z.json)	config_filer   r   exists
ValueErrorr   endswithZto_json_fileZto_yaml_file)argsr   config r   b/var/www/html/Darija-Ai-Train/env/lib/python3.8/site-packages/accelerate/commands/config/update.pyupdate_config   s    

r   c                 C   s2   | j d|ttd} | jdd dd | jtd | S )Nupdate)parentshelpformatter_classz--config_fileaQ  The path to the config file to update. 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'.)defaultr   )func)
add_parserdescriptionr   add_argumentset_defaultsupdate_config_command)parserr   r   r   r   update_command_parser,   s    r   c                 C   s   t | }td| d d S )Nz.Sucessfully updated the configuration file at .)r   print)r   r   r   r   r   r   =   s    r   N)pathlibr   Zconfig_argsr   r   Zconfig_utilsr   r   r   r   r   r   r   r   r   <module>   s   