Skip to content

Commit 2a68c48

Browse files
justinchubyCopilot
andcommitted
Address PR #236 review: drop Gemma4 hunks, document limitations
- Rebase onto latest main, dropping Gemma4 commits (already in PR #239) - Document batch=1 limitation in FunASREmbeddingModel - Document audio_token_id=0 collision workaround - Add explicit shape-unknown comment in SkipLayerNorm rank guard Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Signed-off-by: Justin Chu <justinchu@microsoft.com>
1 parent ab1ad79 commit 2a68c48

2 files changed

Lines changed: 15 additions & 1 deletion

File tree

src/mobius/models/fun_asr.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -338,6 +338,17 @@ class FunASREmbeddingModel(nn.Module):
338338
339339
Output:
340340
inputs_embeds: ``(batch, seq_len, hidden_size)``
341+
342+
Note:
343+
This model only supports ``batch=1``. The CumSum-based audio scatter
344+
uses a flat ``audio_features`` table shared across the batch, so with
345+
``batch > 1`` each row's cumsum restarts at 1 and indexes the same
346+
prefix of ``audio_features``.
347+
348+
When ``audio_token_id`` is 0, generated token 0 during autoregressive
349+
decoding would collide with audio placeholders. Callers should bypass
350+
this model for decode steps and use the embed_tokens weight table
351+
directly (see ``examples/fun_asr.py``).
341352
"""
342353

343354
def __init__(self, config: ArchitectureConfig):

src/mobius/rewrite_rules/_skip_layer_norm.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,8 @@ def check(self, context, add_out, norm_out, **_):
7474
# Both Add inputs must have at least 2 dimensions. This prevents
7575
# fusing a bias-Add (e.g. MatMul + 1D bias → LayerNorm) which
7676
# would produce a SkipLayerNormalization with a 1D skip input
77-
# that ORT rejects.
77+
# that ORT rejects. Unknown shapes are allowed through since
78+
# most intermediate values lack static shape info.
7879
for i, inp in enumerate(producer.inputs):
7980
if inp is not None and inp.shape is not None:
8081
rank = len(inp.shape)
@@ -157,6 +158,8 @@ def check(self, context, add_out, norm_out, **_):
157158

158159
# Both Add inputs must have at least 2 dimensions — reject
159160
# bias-Add patterns (e.g. MatMul + 1D bias → LayerNorm).
161+
# Unknown shapes are allowed through since most intermediate
162+
# values lack static shape info.
160163
for i, inp in enumerate(producer.inputs):
161164
if inp is not None and inp.shape is not None:
162165
rank = len(inp.shape)

0 commit comments

Comments
 (0)