o
    h[	                     @   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   sj   | j }|du rtt rt}nt| std| dt|}|dr.|| |S || |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   endswithto_json_fileto_yaml_file)argsr   config r   W/var/www/html/ai/venv/lib/python3.10/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   config_argsr   r   config_utilsr   r   r   r   r   r   r   r   r   <module>   s   