Skip to content

Commit 28881eb

Browse files
Param parsing issue fix (#1182)
2 parents fd81b84 + f78a406 commit 28881eb

File tree

2 files changed

+18
-2
lines changed

2 files changed

+18
-2
lines changed

ads/aqua/common/utils.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -832,7 +832,9 @@ def get_params_dict(params: Union[str, List[str]]) -> dict:
832832
"""
833833
params_list = get_params_list(params) if isinstance(params, str) else params
834834
return {
835-
split_result[0]: split_result[1] if len(split_result) > 1 else UNKNOWN
835+
split_result[0]: " ".join(split_result[1:])
836+
if len(split_result) > 1
837+
else UNKNOWN
836838
for split_result in (x.split() for x in params_list)
837839
}
838840

@@ -881,7 +883,9 @@ def build_params_string(params: dict) -> str:
881883
A params string.
882884
"""
883885
return (
884-
" ".join(f"{name} {value}" for name, value in params.items()).strip()
886+
" ".join(
887+
f"{name} {value}" if value else f"{name}" for name, value in params.items()
888+
).strip()
885889
if params
886890
else UNKNOWN
887891
)

tests/unitary/with_extras/aqua/test_utils.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -171,3 +171,15 @@ def test_list_os_files_with_extension(self, oss_mock: MagicMock):
171171
oss_mock_client.filepath = prefix
172172
resp = utils.list_os_files_with_extension(prefix, ".gguf")
173173
self.assertIn(obj2_name, resp)
174+
175+
@parameterized.expand(
176+
[
177+
"--gpu-memory-utilization 0.98 --max-loras 2 --lora-modules speech=artifact/speech-lora vision=artifact/vision-lora --dtype auto --trust-remote-code",
178+
"--gpu-memory-utilization 0.98 --dtype auto --trust-remote-code",
179+
"--trust-remote-code --max-model-len 4096",
180+
"",
181+
]
182+
)
183+
def test_parse_params(self, params):
184+
params_dict = utils.get_params_dict(params)
185+
self.assertEqual(params, utils.build_params_string(params_dict))

0 commit comments

Comments
 (0)