Skip to content

[kimi k2.7] Simplify DistMuon bucket construction in the recipe - #4756

Merged
tianyu-l merged 1 commit into
pytorch:mainfrom
JavaZeroo:refactor/k2_7-muon-buckets
Sep 16, 2026
Merged

tianyu-l merged 1 commit into
pytorch:mainfrom
JavaZeroo:refactor/k2_7-muon-buckets

Conversation

@JavaZeroo

@JavaZeroo JavaZeroo commented Sep 16, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Split out of #4596 as requested there. The K2.7 DistMuon recipe built compute_sharding_by_fqn, the per-layer FQN lists and the bucket FQNs through three intermediate tuples and comprehensions; this collapses them into one loop over layers and one loop over bucket groups, and drops bucket_fqns. Pure refactor. K2.7 is the only recipe on main that builds DistMuon buckets; the K3 recipe in #4596 is written the same way.

Test plan

  • Dumped bucket_configs, compute_sharding_by_fqn and the param groups for kimi_k2_5_debugmodel, moonlight_16b_a3b, kimi_k2_5 and kimi_vl_a3b on main and on this branch: identical.
  • pre-commit run and pyrefly clean on the file.

Build compute_sharding_by_fqn and the per-layer FQN lists in one loop
and drop the intermediate bucket_fqns tuple. Pure refactor: the
resulting compute layouts, bucket configs, and param groups are
identical for all four K2.7 recipes.
@pytorch-bot pytorch-bot Bot added the ciflow/fake-pg Run 1-GPU Fake PG integration tests label Sep 16, 2026
@pytorch-bot

pytorch-bot Bot commented Sep 16, 2026 •

Copy link
Copy Markdown

Workflows were awaiting approval. CI has now been triggered for the ciflow labels on this PR.

@tianyu-l
tianyu-l merged commit b6e3853 into pytorch:main Sep 16, 2026
14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ciflow/fake-pg Run 1-GPU Fake PG integration tests 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.

4 participants