[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:
@@ -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))
|
||||
|
||||
Reference in New Issue
Block a user