add: support selecting saved configuration files and loading training parameters

Former-commit-id: 5c9b17c1dc9093da0ea813642bce9b5c9ae96274
This commit is contained in:
hzhaoy
2024-06-04 10:33:43 +08:00
parent 070b944895
commit 39d8d7995a
2 changed files with 15 additions and 2 deletions

View File

@@ -176,6 +176,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.