Skip to content

Commit 4ae2e0b

Browse files
justinchubyCopilot
andcommitted
fix(qwen3-tts): key stacked codec embedding under both initializer names
Per review: don't depend on onnx-ir folding op.Identity(stacked_codec_embedding) and renaming the initializer to `codec_embeddings`. Key the stacked table under BOTH `codec_embeddings` (folded case) and `code_predictor.stacked_codec_embedding` (unfolded case); apply_weights populates whichever initializer exists and only logs the other as unmapped (no error on extra keys), so the table is applied robustly regardless of IR rewrite behavior. Co-authored-by: Copilot <[email protected]> Copilot-Session: bd351e74-2569-444d-a7da-6456f3b5df82
1 parent 7be9c44 commit 4ae2e0b

1 file changed

Lines changed: 7 additions & 4 deletions

File tree

‎src/mobius/models/qwen3_tts.py‎

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -874,15 +874,18 @@ def finalize_stacked_weights(
874874

875875
# Stack codec embeddings: (num_groups-1, cp_vocab, talker_hidden).
876876
# The code predictor exposes this table via `op.Identity(stacked_codec_embedding)`
877-
# as its `codec_embeddings` graph output, and onnx-ir folds the Identity so
877+
# as its `codec_embeddings` graph output. onnx-ir normally folds the Identity so
878878
# the sole initializer takes the OUTPUT name `codec_embeddings` (unprefixed) —
879-
# unlike every other code_predictor initializer. Key the stacked weight to that
880-
# exact initializer name so it is applied (apply_weights routes an unprefixed
881-
# name to the only component that declares it).
879+
# unlike every other code_predictor initializer. To avoid depending on that IR
880+
# rewrite, key the stacked weight under BOTH names: whichever initializer the
881+
# build actually emits (`codec_embeddings` when folded, else
882+
# `code_predictor.stacked_codec_embedding`) is populated, and the other key is
883+
# harmlessly logged as unmapped (apply_weights does not error on extra keys).
882884
if codec_emb_weights:
883885
num_groups = max(codec_emb_weights.keys()) + 1
884886
stacked = torch.stack([codec_emb_weights[i] for i in range(num_groups)])
885887
remaining["codec_embeddings"] = stacked
888+
remaining["code_predictor.stacked_codec_embedding"] = stacked
886889
# Share the same stacked table with the talker step embedder so it
887890
# can materialize codec_sum in-graph (Σ cp_codec_weights[i][code]).
888891
remaining["talker_step_embedder.stacked_codec_embedding"] = stacked

0 commit comments

Comments
 (0)