You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
## Summary
Ran the full integration + L4 (golden) + L5 (generation) suite on GPU
(`MOBIUS_TEST_DEVICE=cuda`, 8× H200) to find regressions and
long-standing
bugs. Triaged 88 failures by root cause. **PR #338 (gemma4 bidirectional
overlay + GQA-cap removal) introduced zero regressions** — every
spot-checked
failure reproduces identically on the parent commit `f972184`.
This PR lands the verified, high-impact fixes. Remaining buckets (deep
numeric/decode bugs, ref-API drift, env/external) are tracked separately
and
will follow.
## Fixes
### 1. Disable TF32 on GPU (`tests/conftest.py`)
On Ampere+/Hopper the ORT CUDA EP uses TF32 for fp32 matmuls by default,
while
the PyTorch reference computes in true fp32. The ~1e-2 logit discrepancy
spuriously failed **~35** fp32 numeric-parity tests (rtol/atol 1e-3).
Set
`NVIDIA_TF32_OVERRIDE=0` in conftest before any CUDA library initializes
(uses
`setdefault` so users can opt back in). Verified: with the env var
unset,
`gpt2` and `qwen2.5-0.5b` L4 now pass.
### 2. transformers ≥5.x flattened ViT/CLIP weight names
(`src/mobius/models/vit.py`)
transformers 5.x flattened the ViT state dict to `layers.N.*` with
consolidated
`attention.{q,k,v,o}_proj` / `mlp.fc1/fc2` names. The legacy rename map
no
longer matched, leaving graph initializers unfilled (ORT load failure).
Added
an **additive** new-naming branch (legacy 5.0–5.9 path preserved) and
aligned
the in-test torch reference modules with the mobius graph param names.
### 3. gemma3 multimodal vision encoder (`src/mobius/models/gemma3.py`)
Two bugs broke the gemma-3 image-text-to-text pipeline:
- The full-VLM `preprocess_weights` prefixed vision weights but didn't
rename
the vision MLP `fc1/fc2` → `up_proj/down_proj`, so FCMLP initializers
were
never filled (ORT load failure).
- The vision encoder returned rank-3 `(batch, tokens, hidden)`, but the
embedding sub-model declares `image_features` as rank-2 and gathers
along
axis 0. Squeeze the batch dim to honor the 2-D contract (matching the
`PixtralVLTask` precedent and the ort-genai runtime).
With both, **gemma-3-4b-it L4 golden passes** on CUDA.
## Verification
- TF32 fix: `gpt2`, `qwen2.5-0.5b` L4 pass with env unset.
- ViT/CLIP parity tests pass.
- gemma-3-4b-it L4 golden passes; 25 gemma3 build/task unit tests pass.
- `lintrunner` clean on all changed files.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
---
## Architecture-diff notes (review follow-up)
Two entries in the `arch-diff-bot` comment (`e005489 -> 2f13c7d`)
deserve explanation:
### falcon: `Gelu` -> `Sigmoid + Mul`
The bloom-GELU fix changed falcon's MLP from a hardcoded
`activation="gelu"` to `activation=config.hidden_act or "gelu"` so
`FCMLP` can be shared with Bloom (which needs `gelu_pytorch_tanh`). For
a **real** falcon config this is a no-op:
`ArchitectureConfig.hidden_act` resolves to `"gelu"` via
`config.activation` (HF `FalconConfig` has no `hidden_act` and defaults
`activation="gelu"`). The arch-diff only showed SiLU (`Sigmoid+Mul`)
because the **synthetic test config** used the generic `_base_config`
default `hidden_act="silu"`. Fixed by setting `hidden_act="gelu"` in
falcon's synthetic config so it matches real Falcon.
### `RotaryEmbedding: num_heads: 2 -> 4`
This is a **false positive** from the diff tool's positional node
matching, *caused by* the SiLU regression above -- not a real change.
Each falcon layer emits two `RotaryEmbedding` nodes: Q-rotary
(`num_heads=4`) and K-rotary (`num_heads=2`, GQA `kv_heads=2`).
Inserting `Sigmoid+Mul` per layer shifted all subsequent node indices by
+2, so the tool aligned base's K-rotary (`num_heads=2`) against head's
Q-rotary (`num_heads=4`). Per-head counts are unchanged at both base and
head. Restoring `Gelu` removes the extra nodes, realigns indices, and
makes this spurious entry disappear.
---------
Signed-off-by: Justin Chu <11205048+justinchuby@users.noreply.github.com>
Co-authored-by: Justin Chu <11205048+justinchuby@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
0 commit comments