o
    rôj\	  ã                   @   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   úr/var/www/html/academy/tools/voices/clone/sv-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/Successfully 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   