
    9i[	                     B    d dl mZ ddlmZmZ ddlmZ dZd Zd Z	d Z
y	)
    )Path   )default_config_fileload_config_from_file)SubcommandHelpFormatterz`Update an existing config file with the latest defaults while maintaining the old configuration.c                 :   | j                   }|$t        t              j                         rt        }n(t        |      j                         st	        d| d      t        |      }|j                  d      r|j                  |       |S |j                  |       |S )zj
    Update an existing config file with the latest defaults while maintaining the old configuration.
    z"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	   configs      k/var/www/html/backtest/airagagent/rag_env/lib/python3.12/site-packages/accelerate/commands/config/update.pyupdate_configr      s     ""Kt$78??A)+%%'=k]/Z[[";/FG$K(  	K(    c                     | j                  d|t        t              } | j                  dd d       | j	                  t
               | 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   s     r   update_command_parserr!   ,   sS    x{\stF
"	  	 23Mr   c                 8    t        |       }t        d| d       y )Nz.Sucessfully updated the configuration file at .)r   print)r   r	   s     r   r   r   =   s    %K	:;-q
IJr   N)pathlibr   config_argsr   r   config_utilsr   r   r   r!   r    r   r   <module>r)      s(   "  C 1 q$"Kr   