Fix pure-text AFD model config identity (release/v0.19.1rc1) - #175
Merged
jiangkuaixue123 merged 2 commits intoJul 29, 2026
Conversation
Signed-off-by: ShwStone <haowenshi@outlook.com>
Signed-off-by: ShwStone <haowenshi@outlook.com>
There was a problem hiding this comment.
Pull request overview
This PR backports the fix for a regression in get_afd_model_config() where converting the model config to an AFD architecture could break the pure-text invariant hf_text_config is hf_config, leading to downstream vLLM-Ascend behavior differences and NPU RoPE failures in certain TP2 + FlashComm1/SP paths.
Changes:
- Switch
get_afd_model_config()todeepcopy(model_config)before rewritinghf_config.architectures, preserving aliasing inside the copied object graph. - Add unit coverage for both pure-text configs (identity preserved) and configs with a genuinely distinct nested
hf_text_config(kept distinct via private copy).
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
afd_plugin/model_executor/models/model_utils.py |
Use deepcopy to preserve hf_config/hf_text_config aliasing when producing the AFD-targeting model config. |
tests/unit/package/test_package.py |
Extend unit tests to assert correct identity/aliasing behavior for pure-text vs. nested text-config layouts. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
jiangkuaixue123
merged commit Jul 29, 2026
921ef6f
into
vllm-project:release/v0.19.1rc1
6 checks passed
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.
Purpose
Backport of #174 to
release/v0.19.1rc1.Fix the model configuration regression introduced by #144 and reported in
#172.
get_afd_model_config()copied and replacedhf_configwithout updatinghf_text_config. For pure-text models, this broke the original identity:vLLM-Ascend consequently treated DeepSeekV2-Lite as a model with a distinct
nested text configuration. Under Attention TP2 with FlashComm1/SP, MLA skipped
the required query/KV gather and passed TP-local
xtogether with full-batchRoPE
cos/sin, causingnpu_interleave_ropeto fail.Issue
Scope
deepcopy, which preserves aliasing withinthe copied object graph, so the pure-text identity
hf_text_config is hf_configis retained automatically.hf_text_configdistinct (as a privatecopy).
Implementation Notes
get_afd_model_config()now deep-copies theModelConfigand updates thearchitecture on the copied
hf_config.deepcopyretains internal aliasing,so for pure-text configs
hf_text_config is hf_configstill holds on the copy;a genuinely distinct nested
hf_text_configstays a separate object.Compared with the shallow-copy variant initially proposed in #174, this avoids
hand-maintaining identity relationships if
ModelConfigevolves, at the costof privatizing all fields of the copied config.
Test Plan
pytest tests/unit/package/test_package.py(CPU-only; vLLM-gated tests runwhere vLLM is installed).
Test Result
nested text config kept distinct).
npu_interleave_ropefailure underAttention TP2 with FlashComm1/SP is resolved and the model runs correctly.
Docs Impact
unit tests.
Essential PR Checklist