Skip to content

[AutoDeploy] Refining AD configurability - #75

Merged
lucaslie merged 2 commits into
feat/ad-2025-07-07from
ll/ad_llm_args_refinements
Jul 9, 2025
Merged

[AutoDeploy] Refining AD configurability#75
lucaslie merged 2 commits into
feat/ad-2025-07-07from
ll/ad_llm_args_refinements

Conversation

@lucaslie

@lucaslie lucaslie commented Jul 9, 2025

Copy link
Copy Markdown

This PR refines AD configurability in the following ways

  • separate out core configs for AD (used in InferenceOptimizer and other core AD classes) into a separate config class
  • use multi inheritance to create LlmArgs class for AD to still provide optional full configurability for expert users if needed
  • Document use cases for both classes and added improved field validators for some overlapping fields like parallel config
  • Limit build_and_run_ad.py CLI to AutoDeployConfig instead of full LlmArgs

New CLI options with reduced configurability:

✗ python build_and_run_ad.py --help                                      

usage: build_and_run_ad.py [-h] [--args [JSON]] [--args.model {str,Path}] [--args.model-factory {AutoModelForCausalLM,AutoModelForImageTextToText}] [--args.model-kwargs Dict[str,Any]] [--args.skip-loading-weights bool]
                           [--args.checkpoint-device {str,null}] [--args.tokenizer {str,Path,null}] [--args.tokenizer-kwargs Dict[str,Any]] [--args.skip-tokenizer-init bool] [--args.disable-overlap-scheduler bool]
                           [--args.mixed-sampler bool] [--args.world-size int] [--args.runtime {demollm,trtllm}] [--args.device str] [--args.kv-cache-dtype str] [--args.attn-backend {flashinfer,triton}]
                           [--args.mla-backend MultiHeadLatentAttention] [--args.free-mem-ratio float] [--args.simple-shard-only bool] [--args.compile-backend {torch-simple,torch-compile,torch-cudagraph,torch-opt}]
                           [--args.cuda-graph-batch-sizes {List[int],null}] [--args.visualize bool] [--args.max-input-len int] [--args.max-num-tokens {int,null}] [--args.max-seq-len int] [--args.max-batch-size int]
                           [--args.attn-page-size int] [--model {str,null}] [--prompt [JSON]] [--prompt.batch-size int] [--prompt.queries {str,List[str]}] [--prompt.sp-kwargs Dict[str,Any]] [--benchmark [JSON]]
                           [--benchmark.enabled bool] [--benchmark.num int] [--benchmark.isl int] [--benchmark.osl int] [--benchmark.bs int] [--benchmark.results-path {str,null}] [--benchmark.store-results bool]
                           [--dry-run | --no-dry-run]

Experiment Configuration for the example script.

    This configuration aggregates all relevant configurations for this example script. It is also
    used to auto-generate the CLI interface.

options:
   [...]

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR introduces a dedicated AutoDeployConfig for core AutoDeploy settings, refactors LlmArgs to inherit from it, updates transform and executor components to use the new config, adjusts tests and the example CLI/script to reflect the change, and enhances documentation.

  • Introduce AutoDeployConfig and refactor LlmArgs as a subclass
  • Update transforms (InferenceOptimizer, KV cache) and executor to accept AutoDeployConfig
  • Revise tests, example script, and README to use AutoDeployConfig

Reviewed Changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
tests/.../test_ad_build_small_single.py Updated test helper to use LlmArgs/AutoDeployConfig mapping
tests/.../test_llm_config.py Added parallel-config validation tests
tensorrt_llm/.../transformations/transform.py Switch InferenceOptimizer to accept AutoDeployConfig and return nn.Module
tensorrt_llm/.../transformations/library/kvcache.py Adjusted typing and signature of insert_cached_attention
tensorrt_llm/.../shim/ad_executor.py Updated build_from_config to accept AutoDeployConfig
tensorrt_llm/_torch/auto_deploy/llm_args.py Introduced AutoDeployConfig, reworked LlmArgs inheritance
examples/auto_deploy/build_and_run_ad.py Switched CLI script to use AutoDeployConfig
examples/auto_deploy/README.md Updated README to highlight AutoDeployConfig usage
Comments suppressed due to low confidence (3)

tests/unittest/_torch/auto_deploy/unit/singlegpu/test_ad_build_small_single.py:13

  • The assertion message still refers to "ad_config" even though the parameter is now named llm_args; please update it for consistency.
def _check_ad_config(experiment_config: ExperimentConfig, llm_args: LlmArgs):

tensorrt_llm/_torch/auto_deploy/transformations/library/kvcache.py:53

  • The signature now returns None, but an earlier code path still returns egm; callers expecting a GraphModule may break. Either consistently return the module or update callers to use in-place mutation.
) -> None:

tensorrt_llm/_torch/auto_deploy/llm_args.py:12

  • Path is used here but not imported; add from pathlib import Path to avoid a NameError.
PathLike = Union[str, Path]

Comment thread tests/unittest/_torch/auto_deploy/unit/singlegpu/shim/test_llm_config.py Outdated
Comment thread tensorrt_llm/_torch/auto_deploy/llm_args.py

@nzmora-nvidia nzmora-nvidia left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Comment thread examples/auto_deploy/README.md Outdated

@galagam galagam left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall LGTM, but I'm not familiar enough with the code base.

Comment thread tensorrt_llm/_torch/auto_deploy/llm_args.py Outdated
lucaslie added 2 commits July 9, 2025 13:24
Signed-off-by: Lucas Liebenwein <11156568+lucaslie@users.noreply.github.com>
Signed-off-by: Lucas Liebenwein <11156568+lucaslie@users.noreply.github.com>
@lucaslie
lucaslie force-pushed the ll/ad_llm_args_refinements branch from 696c4b0 to a2f7dbd Compare July 9, 2025 20:52
@lucaslie
lucaslie enabled auto-merge (squash) July 9, 2025 20:52
@lucaslie
lucaslie merged commit 11d1670 into feat/ad-2025-07-07 Jul 9, 2025
1 check passed
lucaslie added a commit that referenced this pull request Jul 18, 2025
* [AutoDeploy] Refining AD configurability

Signed-off-by: Lucas Liebenwein <11156568+lucaslie@users.noreply.github.com>

* addressed reviewer feedback

Signed-off-by: Lucas Liebenwein <11156568+lucaslie@users.noreply.github.com>

---------

Signed-off-by: Lucas Liebenwein <11156568+lucaslie@users.noreply.github.com>
lucaslie added a commit that referenced this pull request Jul 21, 2025
* [AutoDeploy] Refining AD configurability

Signed-off-by: Lucas Liebenwein <11156568+lucaslie@users.noreply.github.com>

* addressed reviewer feedback

Signed-off-by: Lucas Liebenwein <11156568+lucaslie@users.noreply.github.com>

---------

Signed-off-by: Lucas Liebenwein <11156568+lucaslie@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants