Skip to content

gemma4: add image and audio support - #22

Closed
pd95 wants to merge 58 commits into
feature/apertus-mlxfrom
feature/gemma4-mlx-image-audio
Closed

pd95 wants to merge 58 commits into
feature/apertus-mlxfrom
feature/gemma4-mlx-image-audio

Conversation

@pd95

@pd95 pd95 commented Aug 28, 2026

Copy link
Copy Markdown
Owner

v0.33.2 refresh

Reconstructed unchanged on official Ollama v0.33.2 (f96e7aa0513b9973a0ccc71be414c2ecb9d65b1a). New head: 1a1e866d69ac6419e998d8968a45e0fc828cc741; base: feature/apertus-mlx.

All 18 patch IDs and semantic range-diff rows are unchanged. Diff hygiene and the exact OpenAI/server/create/runner/Gemma/Glimmer/Qwen packages with tests passed. Final integrated Linux and Darwin build gates passed.

Ordered image/audio runtime and packaged behavior remain subject to later release qualification; no source/reference parity claim is added here.

@pd95

pd95 commented Aug 28, 2026

Copy link
Copy Markdown
Owner Author

This PR replaces the earlier v0.32.x review in #16 after the stack was refreshed onto the v0.33.1 release base. #16 remains the historical review record; this PR is the active v0.33.1 review.

pd95 and others added 29 commits August 30, 2026 18:56
Co-authored-by: Codex <noreply@openai.com>
Preserve namespace wire identities across declarations, history, and output while rejecting ambiguous model-facing names before dispatch.

Co-authored-by: Codex <noreply@openai.com>
Co-authored-by: Codex <noreply@openai.com>
Bridge the narrow Responses custom apply_patch grammar through the request-wide injective resolver, preserving history, mixed output, streaming identity, and safe fallback behavior.

Co-authored-by: Codex <noreply@openai.com>
Co-authored-by: Codex <noreply@openai.com>
Co-authored-by: Codex <noreply@openai.com>
Co-authored-by: Codex <noreply@openai.com>
Co-authored-by: Codex <noreply@openai.com>
Co-authored-by: Codex <noreply@openai.com>
Co-authored-by: Codex <noreply@openai.com>
Co-authored-by: Codex <noreply@openai.com>
Co-authored-by: Codex <noreply@openai.com>
Co-authored-by: Codex <noreply@openai.com>
Co-authored-by: Codex <noreply@openai.com>
Co-authored-by: Codex <noreply@openai.com>
Co-authored-by: Codex <noreply@openai.com>
Co-authored-by: Codex <noreply@openai.com>
Co-authored-by: Codex <noreply@openai.com>
Co-authored-by: Codex <noreply@openai.com>
Co-authored-by: Codex <noreply@openai.com>
Co-authored-by: Codex <noreply@openai.com>
Co-authored-by: Codex <noreply@openai.com>
Co-authored-by: Codex <noreply@openai.com>
Co-authored-by: Codex <noreply@openai.com>
Co-authored-by: Codex <noreply@openai.com>
Guard dynamic expert selectors inside the fused Metal kernels so decode no longer reads router output back to the CPU on every layer. Preserve static validation and cover mixed valid and invalid selectors across multiple threadgroups.

Co-authored-by: Codex <noreply@openai.com>
Co-authored-by: Codex <noreply@openai.com>
Co-authored-by: Codex <noreply@openai.com>
Co-authored-by: Codex <noreply@openai.com>
pd95 and others added 23 commits August 30, 2026 19:11
Co-authored-by: Codex <noreply@openai.com>
Co-authored-by: Codex <noreply@openai.com>
Co-authored-by: Codex <noreply@openai.com>
Co-authored-by: Codex <noreply@openai.com>
Co-authored-by: Codex <noreply@openai.com>
Parse Gemma 4 multimodal config and tokenizer tokens, load the vision tower plus embed_vision projector, preprocess ordered images through the official media contract, and scatter lazy projected vision features into the language embedding stream.

Co-authored-by: Codex <noreply@openai.com>
Advertise Gemma 4 vision now that the MLX model implements the official media contract, while retaining audio suppression until its runtime lands. Verify the centralized import policy preserves Gemma media tensors at source precision.

Co-authored-by: Codex <noreply@openai.com>
Require both the Gemma 4 vision tower and projector in source inventories and local manifests before advertising MLX vision, while preserving current centralized capability detection and unrelated model-family suppression.

Co-authored-by: Codex <noreply@openai.com>
Validate executable source, installed, server, and runtime vision contracts including tensor payload ranges; bound descriptor extraction; propagate live request cancellation; and preserve accepted Gemma, Glimmer, and Qwen behavior.

Co-authored-by: Codex <noreply@openai.com>
Load and validate encoder-free unified vision tensors, prepare bounded HWC patch rows and positions, and carry request-local image spans for sliding-layer attention relaxation.

Co-authored-by: Codex <noreply@openai.com>
Validate bounded released Gemma 4 audio configuration and complete source and installed tensor inventories before advertising audio. Inspect installed descriptors and payloads with the accepted media safeguards while keeping create, show, and list capability views consistent.

Co-authored-by: Codex <noreply@openai.com>
Add the bounded waveform-to-feature preprocessing used by released Gemma 4 audio checkpoints, with deterministic reference coverage.

Co-authored-by: Codex <noreply@openai.com>
Load the released conformer audio tower, prepare ordered WAV segments into cache-keyed feature rows, encode them lazily from runner-owned media data, and scatter projected audio features through the official media contract alongside images.

Co-authored-by: Codex <noreply@openai.com>
Add a deterministic end-to-end reference for the released audio tower and projector.

Co-authored-by: Codex <noreply@openai.com>
Tighten audio configuration, source inventory, manifest, preprocessing, and forward-reference validation while exercising lazy media encoding and the two-result model Forward contract.

Co-authored-by: Codex <noreply@openai.com>
Require the tokenizer and processor metadata consumed by the audio runtime, validate numerical configuration parity, and align capability reporting with the actual prepared audio path.

Co-authored-by: Codex <noreply@openai.com>
Co-authored-by: Codex <noreply@openai.com>
Co-authored-by: Codex <noreply@openai.com>
Support the unified 12B raw-waveform audio projection within the official lazy media contract while preserving the released conformer path and shared readiness validation.

Co-authored-by: Codex <noreply@openai.com>
Reject mixed or unsupported Gemma 4 audio architecture metadata before capability reporting or runtime construction.

Co-authored-by: Codex <noreply@openai.com>
Co-authored-by: Codex <noreply@openai.com>
Extend the canonical Gemma 4 media descriptor contract to support quantized vision and audio tensors while preserving dense readiness and runtime validation.

Co-authored-by: Codex <noreply@openai.com>
Include unified vision_embedder tensor layers in the canonical installed descriptor inventory so capability reporting validates the complete model rather than suppressing a valid unified vision model.

Co-authored-by: Codex <noreply@openai.com>
@pd95
pd95 force-pushed the feature/gemma4-mlx-image-audio branch from 5bec6a8 to 1a1e866 Compare August 31, 2026 05:38
@pd95
pd95 force-pushed the feature/apertus-mlx branch 2 times, most recently from 2fd492f to 1d29ce9 Compare September 5, 2026 09:33
@pd95

pd95 commented Sep 5, 2026

Copy link
Copy Markdown
Owner Author

Official Ollama v0.33.3 now supplies the Gemma 4 image/audio implementation that this draft carried, so this PR is superseded rather than replayed.

The remaining accepted shared-media gaps continue in #23, refreshed directly on #6: bounded generic MP3 decoding, Gemma/CLI MP3 acceptance, bounded WebP conversion, and request-wide media limits. The prior 30-second whole-clip rejection is deliberately not retained because v0.33.3 provides bounded Gemma audio chunking.

Closing this draft preserves its history; it does not claim that its 18-commit implementation was merged into the replacement branch.

@pd95

pd95 commented Sep 14, 2026

Copy link
Copy Markdown
Owner Author

Superseded for the v0.34.0 refresh by #23. Official v0.34.0 now contains the original Gemma 4 image/audio implementation; #23 carries only the remaining shared-media hardening and documents the replacement scope.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant