Skip to content

[AutoDeploy] yaml config loader for dynamic settings (closes #4366) - #73

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

[AutoDeploy] yaml config loader for dynamic settings (closes #4366)#73
lucaslie merged 3 commits into
feat/ad-2025-07-07from
ll/yaml_config_mixin

Conversation

@lucaslie

@lucaslie lucaslie commented Jul 7, 2025

Copy link
Copy Markdown

This PR introduces a utility (as a mix-in class) to dynamically merge yaml config files into pydantic base settings (our config system in TRT-LLM).

For now, it's only used in the accompanying unit test but I anticipate this to the main mechanism to configure our modular InferenceOptimizer (i.e. a custom InferenceOptimizer = default class + custom yaml config).

Other argument sources (like CLI arguments), default values, and init values are still valid as well of course

@lucaslie lucaslie self-assigned this Jul 7, 2025
Copilot AI review requested due to automatic review settings July 7, 2025 20:33

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 adds a mix-in and settings source class to enable dynamic, deep-merged YAML configs in Pydantic-based settings, plus a comprehensive test suite covering merge behavior and precedence.

  • Introduces DynamicYamlWithDeepMergeSettingsSource and DynamicYamlMixInForSettings for loading and merging multiple YAML files.
  • Adds extensive unit tests in test_config.py to validate loading, merge order, nested settings, env overrides, and error handling.

Reviewed Changes

Copilot reviewed 2 out of 3 changed files in this pull request and generated 4 comments.

File Description
tests/unittest/_torch/auto_deploy/unit/singlegpu/utils/test_config.py Added a broad suite of tests for dynamic YAML config loading, merging, and precedence
tensorrt_llm/_torch/auto_deploy/utils/_config.py Implemented dynamic YAML settings source with deep merge and the corresponding mix-in
Comments suppressed due to low confidence (1)

tests/unittest/_torch/auto_deploy/unit/singlegpu/utils/test_config.py:321

  • The docstring doesn't match the test's intention (inner init should take precedence). Update it to describe that inner init arguments override outer YAML configs.
    """Test precedence: outer yaml configs override inner yaml configs."""

Comment thread tensorrt_llm/_torch/auto_deploy/utils/_config.py Outdated
Comment thread tensorrt_llm/_torch/auto_deploy/utils/_config.py
Comment thread tensorrt_llm/_torch/auto_deploy/utils/_config.py Outdated
@suyoggupta

Copy link
Copy Markdown

I'll be useful to see how ergonomic it is to use yaml to configure the inference optimizer -- a comment for the follow-up PR

@lucaslie lucaslie left a comment

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

TODO: add commit with changes currently on the ll/base_transformation branch

Comment thread tensorrt_llm/_torch/auto_deploy/utils/_config.py
Comment thread tensorrt_llm/_torch/auto_deploy/utils/_config.py
lucaslie added 3 commits July 9, 2025 13:14
Signed-off-by: Lucas Liebenwein <11156568+lucaslie@users.noreply.github.com>
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/yaml_config_mixin branch from 897858d to e00809d Compare July 9, 2025 20:17
@lucaslie
lucaslie merged commit c98cf11 into feat/ad-2025-07-07 Jul 9, 2025
1 check passed
lucaslie added a commit that referenced this pull request Jul 18, 2025
) (#73)

* yaml config loader for dynamic settings

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

* updates for yaml mixin

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

* addressing 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
) (#73)

* yaml config loader for dynamic settings

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

* updates for yaml mixin

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

* addressing 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.

4 participants