GLM-5.3-Flash-DFly2-B6 release does not load into `DFlashDraftModel` (config mismatch, mHC check, MoE key layout)

オープン
#23 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

評価

難易度
4/5
見積もり時間
3〜5日
初心者へのやさしさ
52/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
活発
技術スタック
json, python

調査の方向性

Start with angelspec/models/draft/dflash.py around the DFlashConfig mHC validation and angelspec/config/dfly2_glm53_flash_draft_config.json, then inspect tools/convert_to_hf.py for checkpoint-key conversion. Reproduce loading the released config and checkpoint, including the missing embed_tokens.weight handling. Done means the released config loads, per-expert and fused MoE weights round-trip, and tests cover the mHC/MoE layout.

索引モデルが issue の本文から書いたものです。

説明

angelspec/config/dfly2_glm53_flash_draft_config.json does not describe the released GLM-5.3-Flash-DFly2-B6:

field repo config release config.json
num_hidden_layers 5 3
target KV layers 27, 31, 35, 39, 43 35, 39, 43
MLP dense, 12288 MoE, 128 routed, top-3, 1 shared
hc_mult 1 4 (20 Sinkhorn iters)
hidden correction plain attentive, gated, hidden_embed, 4096

Building a config with the release values fails in DFlashConfig:

https://github.com/Tencent/AngelSpec/blob/main/angelspec/models/draft/dflash.py#L686-L690

if hc_mult > 1:
    if attention_type != "dsv41_mla":
        raise ValueError(
            "hc_mult > 1 is DeepSeek-V4.1's mHC residual; set attention_type 'dsv41_mla'"
        )

The release combines mHC with glm53_mla. With hc_mult, hc_sinkhorn_iters and hc_eps set on the config after construction, the forward runs.

The checkpoint also stores the MoE per expert (mlp.experts.<e>.{gate,up,down}_proj.weight, mlp.shared_experts.*, mlp.gate.weight, mlp.gate.e_score_correction_bias), while the draft MoE expects fused mlp.experts_{gate,up,down}_proj.weight of shape [E, in, out], mlp.shared_mlp.*, mlp.router.gate.weight and mlp.expert_bias. Nothing in tools/ converts between the two. Stacking the transposed per-expert weights and renaming the shared/router keys loads with no unexpected keys; only embed_tokens.weight is missing (taken from the target).

Loaded this way, the model matches an independent implementation of the release on GLM-5.3-Flash target features (layer 35/39/43 KV latents, indexer picks, final hidden) at 12 anchors over two prompts: corrected drafts identical at all 12 (60/60 slots), backbone hidden within ~1% relative.

Suggested fix: allow hc_mult > 1 with glm53_mla, ship the release config, and add a per-expert ↔ fused conversion (fused → per-expert in tools/convert_to_hf.py). Happy to send a PR with a round-trip test.

Env: Python 3.12, torch 2.15 (CPU), transformers 4.57.6, macOS.

主要言語
Python
スター
460
フォーク
40
平均マージ
1時間 4分
マージ済み PR(30日)
4

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

Tencent/AngelSpec のほかの issue

Tencent/AngelSpec の issue をすべて見る

似ている issue

Python の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。