[AutoDeploy] Refining AD configurability - #75
Merged
Conversation
There was a problem hiding this comment.
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
AutoDeployConfigand refactorLlmArgsas a subclass - Update transforms (
InferenceOptimizer, KV cache) and executor to acceptAutoDeployConfig - 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 returnsegm; callers expecting aGraphModulemay break. Either consistently return the module or update callers to use in-place mutation.
) -> None:
tensorrt_llm/_torch/auto_deploy/llm_args.py:12
Pathis used here but not imported; addfrom pathlib import Pathto avoid a NameError.
PathLike = Union[str, Path]
lucaslie
commented
Jul 9, 2025
nzmora-nvidia
approved these changes
Jul 9, 2025
MrGeva
approved these changes
Jul 9, 2025
galagam
approved these changes
Jul 9, 2025
galagam
left a comment
There was a problem hiding this comment.
Overall LGTM, but I'm not familiar enough with the code base.
Signed-off-by: Lucas Liebenwein <11156568+lucaslie@users.noreply.github.com>
Signed-off-by: Lucas Liebenwein <11156568+lucaslie@users.noreply.github.com>
lucaslie
force-pushed
the
ll/ad_llm_args_refinements
branch
from
July 9, 2025 20:52
696c4b0 to
a2f7dbd
Compare
lucaslie
enabled auto-merge (squash)
July 9, 2025 20:52
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR refines AD configurability in the following ways
InferenceOptimizerand other core AD classes) into a separate config classLlmArgsclass for AD to still provide optional full configurability for expert users if neededbuild_and_run_ad.pyCLI toAutoDeployConfiginstead of fullLlmArgsNew 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: [...]