-
Notifications
You must be signed in to change notification settings - Fork 2k
[None] [feat] Support multiple accuracy tasks for slurm scripts #10500
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
Signed-off-by: Kaiyu Xie <[email protected]>
📝 WalkthroughWalkthroughThe accuracy evaluation workflow was refactored by deleting the Changes
Sequence DiagramsequenceDiagram
participant submit as submit.py
participant pip as pip
participant lmeval as lm_eval
participant endpoint as Model Endpoint
participant logs as Task Logs
submit->>pip: install lm_eval
pip-->>submit: installed
submit->>submit: iterate accuracy_tasks
loop for each task
submit->>endpoint: resolve endpoint<br/>(local-completions/chat)
endpoint-->>submit: endpoint URL
submit->>submit: construct model_args<br/>(model_path, base_url, extra_args)
submit->>submit: build lm_eval command
submit->>logs: prepare per-task log stream
logs-->>submit: log file ready
submit->>submit: append command to<br/>execution list
end
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes 🚥 Pre-merge checks | ✅ 1 | ❌ 2❌ Failed checks (2 warnings)
✅ Passed checks (1 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 2
🤖 Fix all issues with AI agents
In @examples/disaggregated/slurm/benchmark/submit.py:
- Line 378: The generated --model_args string can end with a trailing comma when
config['accuracy']['tasks'][task]['model_args_extra'] is empty; change the
construction in submit.py (the line that builds the '--model_args' arg using
env_config['model_path'], disagg_server_hostname, disagg_server_port,
end_point_map[model], and config['accuracy']['tasks'][task]['model_args_extra'])
to conditionally include the extra part only when non-empty (e.g., build a list
of parts like "model=...", "base_url=..." and append model_args_extra only if
truthy, then join with commas) so the final --model_args value never ends with
an extraneous comma.
- Around line 358-384: Default config uses a string for
config['accuracy']['tasks'] but the new loop treats it like a dict, causing
iteration and key errors; update the code to normalize and validate tasks before
the loop (e.g., if isinstance(config['accuracy']['tasks'], str) convert it to
{config['accuracy']['tasks']: {}} or to a list/dict shape the rest of the code
expects), and inside the loop access per-task data safely using .get() (use
task_cfg = config['accuracy']['tasks'].get(task, {}) and model =
task_cfg.get('model', '<default_model>') and model_args_extra =
task_cfg.get('model_args_extra', '')), and guard end_point_map lookup with a
fallback or explicit validation (e.g., endpoint = end_point_map.get(model) and
raise/log a clear error if None) so the code never assumes keys exist.
🧹 Nitpick comments (1)
examples/disaggregated/slurm/benchmark/submit.py (1)
369-372: Moveend_point_mapoutside the loop.The
end_point_mapdictionary is constant and doesn't need to be recreated on every iteration.Suggested refactor
if config['accuracy']['enable_accuracy_test']: install_dep_cmd = "pip3 install lm_eval[api]==0.4.9.2" client_cmds.append(" ".join(client_slurm_prefix) + " " + install_dep_cmd) + end_point_map = { + 'local-completions': 'v1/completions', + 'local-chat-completions': 'v1/chat/completions', + } for task in config['accuracy']['tasks']: # ... extra_kwargs handling ... - end_point_map = { - 'local-completions': 'v1/completions', - 'local-chat-completions': 'v1/chat/completions', - } model = config['accuracy']['tasks'][task]['model']
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
examples/disaggregated/slurm/benchmark/accuracy_eval.shexamples/disaggregated/slurm/benchmark/submit.py
💤 Files with no reviewable changes (1)
- examples/disaggregated/slurm/benchmark/accuracy_eval.sh
🧰 Additional context used
📓 Path-based instructions (2)
**/*.py
📄 CodeRabbit inference engine (CODING_GUIDELINES.md)
**/*.py: The code developed for TensorRT-LLM should conform to Python 3.8+
Indent Python code with 4 spaces. Do not use tabs
Always maintain the namespace when importing Python modules, even if only one class or function from a module is used
Python filenames should use snake_case (e.g.,some_file.py)
Python classes should use PascalCase (e.g.,class SomeClass)
Python functions and methods should use snake_case (e.g.,def my_awesome_function():)
Python local variables should use snake_case, with prefixkfor variable names that start with a number (e.g.,k_99th_percentile)
Python global variables should use upper snake_case with prefixG(e.g.,G_MY_GLOBAL)
Python constants should use upper snake_case (e.g.,MY_CONSTANT)
Avoid shadowing variables declared in an outer scope in Python
Initialize all externally visible members of a Python class in the constructor
For Python interfaces that may be used outside a file, prefer docstrings over comments
Use comments in Python for code within a function, or interfaces that are local to a file
Use Google-style docstrings for Python classes and functions, which can be parsed by Sphinx
Python attributes and variables can be documented inline with the format"""<type>: Description"""
Avoid using reflection in Python when functionality can be easily achieved without reflection
When using try-except blocks in Python, limit the except clause to the smallest set of errors possible
When using try-except blocks in Python to handle multiple possible variable types (duck-typing), keep the body of the try as small as possible and use the else block for the main logic
Files:
examples/disaggregated/slurm/benchmark/submit.py
**/*.{cpp,cc,cxx,h,hpp,hxx,cu,cuh,py}
📄 CodeRabbit inference engine (CODING_GUIDELINES.md)
All TensorRT-LLM source files (.cpp, .h, .cu, .py, and other source files) should contain an NVIDIA copyright header with the year of latest meaningful modification
Files:
examples/disaggregated/slurm/benchmark/submit.py
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
- GitHub Check: Pre-commit Check
| install_dep_cmd = "pip3 install lm_eval[api]==0.4.9.2" | ||
| client_cmds.append(" ".join(client_slurm_prefix) + " " + install_dep_cmd) | ||
| for task in config['accuracy']['tasks']: | ||
| extra_kwargs = config['accuracy']['tasks'][task].get('extra_kwargs', {}) | ||
| extra_kwargs_str = "" | ||
| for key, value in extra_kwargs.items(): | ||
| if isinstance(value, bool): | ||
| if value: | ||
| extra_kwargs_str += f" --{key}" | ||
| else: | ||
| extra_kwargs_str += f" --{key}='{value}'" | ||
| end_point_map = { | ||
| 'local-completions': 'v1/completions', | ||
| 'local-chat-completions': 'v1/chat/completions', | ||
| } | ||
| model = config['accuracy']['tasks'][task]['model'] | ||
| accuracy_cmd = [ | ||
| 'lm_eval', | ||
| '--model', model, | ||
| '--tasks', task, | ||
| '--model_args', f"model={env_config['model_path']},base_url=http://{disagg_server_hostname}:{disagg_server_port}/{end_point_map[model]},{config['accuracy']['tasks'][task]['model_args_extra']}", | ||
| '--log_samples', | ||
| '--output_path', f'{log_dir}/accuracy_eval_{task}', | ||
| extra_kwargs_str, | ||
| f"&> {log_dir}/7_accuracy_eval_{task}.log" | ||
| ] | ||
| client_cmds.append(" ".join(client_slurm_prefix + accuracy_cmd)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Critical: Type mismatch between default config and new task iteration logic.
The default accuracy config at lines 152-163 sets 'tasks': 'gsm8k' as a string, but the new code iterates over config['accuracy']['tasks'] as a dictionary (line 360). This will cause a runtime error when using the default config, as iterating over a string yields individual characters.
Additionally:
- Line 373: Accessing
['model']without.get()will raiseKeyErrorif not specified. - Line 378: Accessing
['model_args_extra']without.get()will raiseKeyErrorif not specified. - Line 378:
end_point_map[model]will raiseKeyErrorifmodelis not one of the two supported types.
Proposed fix
First, update the default config structure to match the new expected format (lines 152-163):
if 'accuracy' not in config:
config['accuracy'] = {
- 'enable_accuracy_test':
- False,
- 'model':
- 'local-completions',
- 'tasks':
- 'gsm8k',
- 'model_args_extra':
- 'num_concurrent=512,max_retries=3,tokenized_requests=false,timeout=1200,max_gen_toks=256,max_length=4096'
+ 'enable_accuracy_test': False,
+ 'tasks': {
+ 'gsm8k': {
+ 'model': 'local-completions',
+ 'model_args_extra': 'num_concurrent=512,max_retries=3,tokenized_requests=false,timeout=1200,max_gen_toks=256,max_length=4096'
+ }
+ }
}Then, add validation and safe access for the task loop:
if config['accuracy']['enable_accuracy_test']:
install_dep_cmd = "pip3 install lm_eval[api]==0.4.9.2"
client_cmds.append(" ".join(client_slurm_prefix) + " " + install_dep_cmd)
+ supported_models = {'local-completions', 'local-chat-completions'}
for task in config['accuracy']['tasks']:
extra_kwargs = config['accuracy']['tasks'][task].get('extra_kwargs', {})
extra_kwargs_str = ""
for key, value in extra_kwargs.items():
if isinstance(value, bool):
if value:
extra_kwargs_str += f" --{key}"
else:
extra_kwargs_str += f" --{key}='{value}'"
end_point_map = {
'local-completions': 'v1/completions',
'local-chat-completions': 'v1/chat/completions',
}
- model = config['accuracy']['tasks'][task]['model']
+ model = config['accuracy']['tasks'][task].get('model', 'local-completions')
+ if model not in supported_models:
+ raise ValueError(f"Unsupported model type '{model}' for task '{task}'. Supported: {supported_models}")
+ model_args_extra = config['accuracy']['tasks'][task].get('model_args_extra', '')
accuracy_cmd = [
'lm_eval',
'--model', model,
'--tasks', task,
- '--model_args', f"model={env_config['model_path']},base_url=http://{disagg_server_hostname}:{disagg_server_port}/{end_point_map[model]},{config['accuracy']['tasks'][task]['model_args_extra']}",
+ '--model_args', f"model={env_config['model_path']},base_url=http://{disagg_server_hostname}:{disagg_server_port}/{end_point_map[model]},{model_args_extra}",
'--log_samples',
'--output_path', f'{log_dir}/accuracy_eval_{task}',
extra_kwargs_str,
f"&> {log_dir}/7_accuracy_eval_{task}.log"
]
client_cmds.append(" ".join(client_slurm_prefix + accuracy_cmd))Committable suggestion skipped: line range outside the PR's diff.
🤖 Prompt for AI Agents
In @examples/disaggregated/slurm/benchmark/submit.py around lines 358 - 384,
Default config uses a string for config['accuracy']['tasks'] but the new loop
treats it like a dict, causing iteration and key errors; update the code to
normalize and validate tasks before the loop (e.g., if
isinstance(config['accuracy']['tasks'], str) convert it to
{config['accuracy']['tasks']: {}} or to a list/dict shape the rest of the code
expects), and inside the loop access per-task data safely using .get() (use
task_cfg = config['accuracy']['tasks'].get(task, {}) and model =
task_cfg.get('model', '<default_model>') and model_args_extra =
task_cfg.get('model_args_extra', '')), and guard end_point_map lookup with a
fallback or explicit validation (e.g., endpoint = end_point_map.get(model) and
raise/log a clear error if None) so the code never assumes keys exist.
| 'lm_eval', | ||
| '--model', model, | ||
| '--tasks', task, | ||
| '--model_args', f"model={env_config['model_path']},base_url=http://{disagg_server_hostname}:{disagg_server_port}/{end_point_map[model]},{config['accuracy']['tasks'][task]['model_args_extra']}", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Trailing comma when model_args_extra is empty.
If model_args_extra is an empty string, the --model_args value will end with a trailing comma (e.g., model=...,base_url=...,), which may cause parsing issues in lm_eval.
Suggested fix
+ model_args_extra = config['accuracy']['tasks'][task].get('model_args_extra', '')
+ model_args_parts = [
+ f"model={env_config['model_path']}",
+ f"base_url=http://{disagg_server_hostname}:{disagg_server_port}/{end_point_map[model]}"
+ ]
+ if model_args_extra:
+ model_args_parts.append(model_args_extra)
accuracy_cmd = [
'lm_eval',
'--model', model,
'--tasks', task,
- '--model_args', f"model={env_config['model_path']},base_url=http://{disagg_server_hostname}:{disagg_server_port}/{end_point_map[model]},{config['accuracy']['tasks'][task]['model_args_extra']}",
+ '--model_args', ','.join(model_args_parts),Committable suggestion skipped: line range outside the PR's diff.
🤖 Prompt for AI Agents
In @examples/disaggregated/slurm/benchmark/submit.py at line 378, The generated
--model_args string can end with a trailing comma when
config['accuracy']['tasks'][task]['model_args_extra'] is empty; change the
construction in submit.py (the line that builds the '--model_args' arg using
env_config['model_path'], disagg_server_hostname, disagg_server_port,
end_point_map[model], and config['accuracy']['tasks'][task]['model_args_extra'])
to conditionally include the extra part only when non-empty (e.g., build a list
of parts like "model=...", "base_url=..." and append model_args_extra only if
truthy, then join with commas) so the final --model_args value never ends with
an extraneous comma.
Summary by CodeRabbit
✏️ Tip: You can customize this high-level summary in your review settings.
Description
Test Coverage
PR Checklist
Please review the following before submitting your PR:
PR description clearly explains what and why. If using CodeRabbit's summary, please make sure it makes sense.
PR Follows TRT-LLM CODING GUIDELINES to the best of your knowledge.
Test cases are provided for new code paths (see test instructions)
Any new dependencies have been scanned for license and vulnerabilities
CODEOWNERS updated if ownership changes
Documentation updated as needed
Update tava architecture diagram if there is a significant design change in PR.
The reviewers assigned automatically/manually are appropriate for the PR.
Please check this after reviewing the above items as appropriate for this PR.
GitHub Bot Help
/bot [-h] ['run', 'kill', 'skip', 'reuse-pipeline'] ...Provide a user friendly way for developers to interact with a Jenkins server.
Run
/bot [-h|--help]to print this help message.See details below for each supported subcommand.
Details
run [--reuse-test (optional)pipeline-id --disable-fail-fast --skip-test --stage-list "A10-PyTorch-1, xxx" --gpu-type "A30, H100_PCIe" --test-backend "pytorch, cpp" --add-multi-gpu-test --only-multi-gpu-test --disable-multi-gpu-test --post-merge --extra-stage "H100_PCIe-TensorRT-Post-Merge-1, xxx" --detailed-log --debug(experimental)]Launch build/test pipelines. All previously running jobs will be killed.
--reuse-test (optional)pipeline-id(OPTIONAL) : Allow the new pipeline to reuse build artifacts and skip successful test stages from a specified pipeline or the last pipeline if no pipeline-id is indicated. If the Git commit ID has changed, this option will be always ignored. The DEFAULT behavior of the bot is to reuse build artifacts and successful test results from the last pipeline.--disable-reuse-test(OPTIONAL) : Explicitly prevent the pipeline from reusing build artifacts and skipping successful test stages from a previous pipeline. Ensure that all builds and tests are run regardless of previous successes.--disable-fail-fast(OPTIONAL) : Disable fail fast on build/tests/infra failures.--skip-test(OPTIONAL) : Skip all test stages, but still run build stages, package stages and sanity check stages. Note: Does NOT update GitHub check status.--stage-list "A10-PyTorch-1, xxx"(OPTIONAL) : Only run the specified test stages. Examples: "A10-PyTorch-1, xxx". Note: Does NOT update GitHub check status.--gpu-type "A30, H100_PCIe"(OPTIONAL) : Only run the test stages on the specified GPU types. Examples: "A30, H100_PCIe". Note: Does NOT update GitHub check status.--test-backend "pytorch, cpp"(OPTIONAL) : Skip test stages which don't match the specified backends. Only support [pytorch, cpp, tensorrt, triton]. Examples: "pytorch, cpp" (does not run test stages with tensorrt or triton backend). Note: Does NOT update GitHub pipeline status.--only-multi-gpu-test(OPTIONAL) : Only run the multi-GPU tests. Note: Does NOT update GitHub check status.--disable-multi-gpu-test(OPTIONAL) : Disable the multi-GPU tests. Note: Does NOT update GitHub check status.--add-multi-gpu-test(OPTIONAL) : Force run the multi-GPU tests in addition to running L0 pre-merge pipeline.--post-merge(OPTIONAL) : Run the L0 post-merge pipeline instead of the ordinary L0 pre-merge pipeline.--extra-stage "H100_PCIe-TensorRT-Post-Merge-1, xxx"(OPTIONAL) : Run the ordinary L0 pre-merge pipeline and specified test stages. Examples: --extra-stage "H100_PCIe-TensorRT-Post-Merge-1, xxx".--detailed-log(OPTIONAL) : Enable flushing out all logs to the Jenkins console. This will significantly increase the log volume and may slow down the job.--debug(OPTIONAL) : Experimental feature. Enable access to the CI container for debugging purpose. Note: Specify exactly one stage in thestage-listparameter to access the appropriate container environment. Note: Does NOT update GitHub check status.For guidance on mapping tests to stage names, see
docs/source/reference/ci-overview.mdand the
scripts/test_to_stage_mapping.pyhelper.kill
killKill all running builds associated with pull request.
skip
skip --comment COMMENTSkip testing for latest commit on pull request.
--comment "Reason for skipping build/test"is required. IMPORTANT NOTE: This is dangerous since lack of user care and validation can cause top of tree to break.reuse-pipeline
reuse-pipelineReuse a previous pipeline to validate current commit. This action will also kill all currently running builds associated with the pull request. IMPORTANT NOTE: This is dangerous since lack of user care and validation can cause top of tree to break.