[Bugfix] fix when config.yaml config value is list parse error (#23528)

Signed-off-by: rongfu.leng <rongfu.leng@daocloud.io>
This commit is contained in:
rongfu.leng
2025-08-27 05:54:39 +00:00
committed by GitHub
parent 9de25c294b
commit 8dbf6ed7be
2 changed files with 48 additions and 2 deletions
+7 -2
View File
@@ -1974,7 +1974,7 @@ class FlexibleArgumentParser(ArgumentParser):
file_path = args[index + 1]
config_args = self._load_config_file(file_path)
config_args = self.load_config_file(file_path)
# 0th index is for {serve,chat,complete}
# optionally followed by model_tag (only for serve)
@@ -2005,7 +2005,7 @@ class FlexibleArgumentParser(ArgumentParser):
return args
def _load_config_file(self, file_path: str) -> list[str]:
def load_config_file(self, file_path: str) -> list[str]:
"""Loads a yaml file and returns the key value pairs as a
flattened list with argparse like pattern
```yaml
@@ -2046,6 +2046,11 @@ class FlexibleArgumentParser(ArgumentParser):
if isinstance(value, bool) and key not in store_boolean_arguments:
if value:
processed_args.append('--' + key)
elif isinstance(value, list):
if value:
processed_args.append('--' + key)
for item in value:
processed_args.append(str(item))
else:
processed_args.append('--' + key)
processed_args.append(str(value))