Skip to content

[rl][spmd_types] DTensor state dict adapter for vLLM HF weights - #4236

Merged
pianpwk merged 5 commits into
mainfrom
gh/pianpwk/84/head
Aug 20, 2026
Merged

[rl][spmd_types] DTensor state dict adapter for vLLM HF weights#4236
pianpwk merged 5 commits into
mainfrom
gh/pianpwk/84/head

Conversation

@pianpwk

@pianpwk pianpwk commented Aug 19, 2026

Copy link
Copy Markdown
Contributor

[ghstack-poisoned]
[ghstack-poisoned]
@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Meta Open Source bot. label Aug 19, 2026
pianpwk added a commit that referenced this pull request Aug 19, 2026
Comment on lines +562 to +584
# FusedSwiGLU exposes split w1/w3 state-dict keys while the
# layout is declared on the fused w13 parameter.
w13_layout = sharding_config.state_shardings.get("w13")
if w13_layout is not None:
for proj_name in ("w1", "w3"):
layouts[f"{module_prefix}{proj_name}.weight"] = w13_layout

if isinstance(module, FusedQKVLinear):
# FusedQKVLinear exposes split wq/wk/wv state-dict keys while
# the layout is declared on the fused wqkv parameter.
wqkv_sharding_config = getattr(
module.wqkv,
"_sharding_config",
None,
)
if wqkv_sharding_config is None:
continue
for (
state_name,
layout,
) in wqkv_sharding_config.state_shardings.items():
for proj_name in ("wq", "wk", "wv"):
layouts[f"{module_prefix}{proj_name}.{state_name}"] = layout

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

pls add a TODO to improve, ideally we should remove these specialized glue code

[ghstack-poisoned]
[ghstack-poisoned]
pianpwk added a commit that referenced this pull request Aug 20, 2026
@pianpwk
pianpwk marked this pull request as ready for review August 20, 2026 17:00
[ghstack-poisoned]
pianpwk added a commit that referenced this pull request Aug 20, 2026
@pianpwk
pianpwk changed the base branch from gh/pianpwk/84/base to main August 20, 2026 18:10
@pianpwk
pianpwk merged commit 731bb10 into main Aug 20, 2026
7 checks passed
acisseJZhong pushed a commit that referenced this pull request Aug 21, 2026
Convert plain local state tensors to DTensors for SPMD-aware HF loading and restore plain tensors before vLLM load.

(cherry picked from commit 9085e29)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ciflow/rl CLA Signed This label is managed by the Meta Open Source bot.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants