Rework --llm-config CLI arg (#2957)

This commit is contained in:
Boxuan Li 2024-07-15 21:17:59 -07:00 committed by GitHub
parent 8f76587e5c
commit e3e437fcc2
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 7 additions and 8 deletions

View File

@ -656,7 +656,7 @@ def get_parser() -> argparse.ArgumentParser:
'--llm-config',
default=None,
type=str,
help='The group of llm settings, e.g. "llama3" for [llm.llama3] section in the toml file. Overrides model if both are provided.',
help='Replace default LLM ([llm] section in config.toml) config with the specified LLM config, e.g. "llama3" for [llm.llama3] section in config.toml',
)
return parser

View File

@ -157,14 +157,13 @@ if __name__ == '__main__':
else:
raise ValueError('No task provided. Please specify a task through -t, -f.')
# Figure out the LLM config
# Override default LLM configs ([llm] section in config.toml)
if args.llm_config:
llm_config = get_llm_config_arg(args.llm_config)
if llm_config is None:
raise ValueError(f'Invalid toml file, cannot read {args.llm_config}')
llm = LLM(llm_config=llm_config)
else:
llm = LLM(llm_config=config.get_llm_config_from_agent(args.agent_cls))
config.set_llm_config(llm_config)
llm = LLM(llm_config=config.get_llm_config_from_agent(args.agent_cls))
# Create the agent
AgentCls: Type[Agent] = Agent.get_cls(args.agent_cls)

View File

@ -41,9 +41,9 @@ options:
--eval-note EVAL_NOTE
The note to add to the evaluation directory
-l LLM_CONFIG, --llm-config LLM_CONFIG
The group of llm settings, e.g. "llama3" for
[llm.llama3] section in the toml file. Overrides model
if both are provided.
Replace default LLM ([llm] section in config.toml)
config with the specified LLM config, e.g. "llama3"
for [llm.llama3] section in config.toml
"""
actual_lines = captured.out.strip().split('\n')