Initial migration of mobius package - #3
Merged
Merged
Conversation
Migrated from onnx-genai-models with full rename: - PyPI package: mobius-ai - Python import: mobius - CLI command: mobius Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Signed-off-by: Justin Chu <justinchuby@users.noreply.github.com>
Performance Comparison
|
🏗️ Architecture Diff
No architecture changes detected. ✅ Legend: ⚪ No change · 🔵 Minor (attrs/inits) · 🟡 Moderate (nodes added/removed) · 🔴 Major (interface changed) |
justinchuby
added a commit
that referenced
this pull request
Apr 13, 2026
Issue #1: Add 2D RoPE to Gemma4VisionSelfAttention with precomputed cos/sin lookup tables (rope_theta=100.0, head_dim//2 frequencies). First head_dim//2 dims use x-coord rotation, last use y-coord rotation, matching HF apply_multidimensional_rope. Issue #2: Add Gemma4VisionPooler with 3x3 AveragePool to reduce N patches to N/9 before projector. Scales by sqrt(hidden_size) matching HF pooler. Adds pooling_kernel_size to VisionConfig (default 3). Issue #3: Gemma4VisionEncoderLayer now reads hidden_act from VisionConfig (default gelu_pytorch_tanh) instead of hardcoding silu. Adds hidden_act to VisionConfig. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Signed-off-by: Justin Chu <justinchuby@users.noreply.github.com>
justinchuby
added a commit
that referenced
this pull request
May 4, 2026
… tests (#240) Addresses 4 review comments from PR #239: ### 1. GQA rewrite rule head_dim limit (#1) Updated `_MAX_GQA_HEAD_DIM` from 256 to 512 in the Attention→GQA rewrite rule to match latest ORT support for head_dim=512. ### 2. GGUF path missing `attention_k_eq_v` (#2) Added `attention_k_eq_v=True` to Gemma4 GGUF postprocessor when `num_global_key_value_heads` is detected. Fixes `build_from_gguf()` for 26b-a4b/31b checkpoints. ### 3. DRY expert weight rename (#3) Extracted `_remap_moe_expert_weights()` shared helper used by both `Gemma4CausalLMModel.preprocess_weights()` and `Gemma4Model.preprocess_weights()`. Single source of truth for expert rename + router scale folding. ### 4. Missing multimodal preprocess_weights test (#4) Added `gemma4_test.py` with 5 targeted tests covering both `Gemma4CausalLMModel` and `Gemma4Model` weight preprocessing: expert rename, router scale folding, and per_expert_scale passthrough. ### Testing - 5/5 new preprocess_weights tests pass - 2668/2668 full suite pass --------- Signed-off-by: Justin Chu <justinchu@microsoft.com> Signed-off-by: Justin Chu <justinchuby@users.noreply.github.com> Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
titaiwangms
added a commit
that referenced
this pull request
Jun 5, 2026
Addresses the Copilot-bot findings from the #340 review assessment: - COPILOT #3 (completes the M3 is_causal=1 sweep): build_graph_test.py test_static_cache_graph_inputs had a stale inline comment claiming causal masking is "handled by is_causal=1 on the Attention op". Updated to the shipped reality (is_causal=0 + explicit offset-aware mask from write_indices). The is_causal=1-mention sweep is now complete across _causal_lm.py (:64, Falcon block) + build_graph_test.py (the remaining :4561/:4610 mentions are correct references to the *rejected* old form, not stale claims). - COPILOT #1 + #2 (indentation): the two negative-control assertions in the decode-frontier and prefill-causal tests were dedented outside their `with tempfile.TemporaryDirectory()` block. Moved them back inside. - Negative-control comparison semantics: reverted the three "logits MUST change" negative controls to exact `assert not np.array_equal` (any bit of change proves the slot was attended). The np.array_equal -> assert_allclose conversion correctly applies ONLY to the "logits UNCHANGED" equality/parity checks, which keep the fp-tolerance compare. Applied consistently to the new batch>1 per-batch mask test as well, and clarified the tolerance-constants comment. Lint clean; static-cache decode 4/4 (CUDA) and build_graph static-cache 10/10 green. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
justinchuby
added a commit
that referenced
this pull request
Jun 12, 2026
…al batch=1 Root cause (PR review finding #3): create_padding_mask and create_sliding_window_mask returned a 3-D (batch, q_len, total) bool mask. The ONNX Attention op right-aligns the mask onto (batch, q_num_heads, q_seq, kv_seq), so the batch axis was read as q_num_heads — harmless for batch==1 (broadcasts as heads=1) but ORT rejects batch>1 ('attn_mask ... not compatible with q_num_heads'). Text decoders therefore silently only supported batch=1 despite declaring a symbolic batch dim. Fix: both maskers now emit a 4-D (batch, 1, q_len, total) mask with an explicit singleton head dim (create_attention_bias already did this). batch==1 output is numerically identical (extra unit dim only). Verified batch=2 prefill (with ragged per-row padding) runs and produces independent rows for qwen2/llama/mistral/gemma2 (plain, GQA, sliding-window). Added: - _common_test.py: 4-D rank + per-row independence tests for both maskers. - build_graph_test.py: TestTextDecoderBatchGreaterThanOne ORT batch=2 test. Multimodal contract honesty: the VLM decoder now genuinely supports batch>1, but the multimodal splits (gemma3 vision Squeeze([0]); phi4mm scalar vision_gate/speech_gate + single flattened feature stream) remain batch=1. Documented those preconditions explicitly. True multimodal batch>1 (per-row modalities, ragged features) is tracked as a follow-up. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Signed-off-by: Justin Chu <11205048+justinchuby@users.noreply.github.com>
titaiwangms
added a commit
that referenced
this pull request
Jun 22, 2026
Fix justinchuby's non-blocking review nits (PR #367): - _dense_reference docstring: correct the stale claim that a fully-masked query row 'yields exactly 0'. The bias-MEA contract keeps every query row's own diagonal slot valid, so a fully-masked row is unreachable by design — the impl asserts idx.size > 0 rather than returning 0. Align the docstring with the assertion (assertion unchanged). - Graph-wiring assertions: read the is_causal attribute via the as_int() convention used in tests/build_graph_test.py and assert the attribute is present (not None) before reading it. For the bias-on case, assert the additive bias (Attention input #3) is both non-None and non-empty (name != ''). Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Signed-off-by: titaiwang <titaiwang@microsoft.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Migrated from onnx-genai-models with full rename: