Merge pull request #4053 from hzhaoy/feature/add_select_config_file

Support selecting saved configuration files

Former-commit-id: 568ef3cf2a793f268cbe01c39dec418a13e61ecd
This commit is contained in:
hoshi-hiyouga
2024-06-06 03:06:03 +08:00
committed by GitHub
2 changed files with 15 additions and 2 deletions

View File

@@ -190,6 +190,18 @@ def list_output_dirs(model_name: str, finetuning_type: str, initial_dir: str) ->
return gr.Dropdown(choices=output_dirs)
def list_config_paths() -> "gr.Dropdown":
"""
Lists all the saved configuration files that can be loaded.
"""
if os.path.exists(DEFAULT_CONFIG_DIR) and os.path.isdir(DEFAULT_CONFIG_DIR):
config_files = [file_name for file_name in os.listdir(DEFAULT_CONFIG_DIR) if file_name.endswith(".yaml")]
else:
config_files = []
return gr.Dropdown(choices=config_files)
def check_output_dir(lang: str, model_name: str, finetuning_type: str, output_dir: str) -> None:
r"""
Check if output dir exists.