MCPcopy
hub / github.com/InternLM/lmdeploy / get_cli_str

Function get_cli_str

autotest/utils/config_utils.py:596–611  ·  view source on GitHub ↗
(config: dict[str, Any])

Source from the content-addressed store, hash-verified

594
595
596def get_cli_str(config: dict[str, Any]) -> str:
597 cli_str = []
598 # Extra params
599 for key, value in config.items():
600 key = key.replace('_', '-')
601 if value is None:
602 cli_str.append(f'--{key}')
603 elif isinstance(value, list):
604 tmp_cli = ' '.join(map(str, value))
605 cli_str.append(f'--{key} {tmp_cli}')
606 elif isinstance(value, dict):
607 tmp_cli = ' '.join([f'{k}={v}' for k, v in value.items()])
608 cli_str.append(f'--{key} {tmp_cli}')
609 else:
610 cli_str.append(f'--{key} {value}' if value else f'--{key}')
611 return ' '.join(cli_str)
612
613
614def get_parallel_config(config: dict[str, Any], model_name: str) -> list[dict[str, int]]:

Callers 3

eval_testFunction · 0.90
mllm_eval_testFunction · 0.90
get_cli_common_paramFunction · 0.85

Calls 3

itemsMethod · 0.80
joinMethod · 0.80
appendMethod · 0.45

Tested by

no test coverage detected