Skip to content

Sync upstream ml-explore/mlx-swift-lm efcedcd (Gemma 4 VLM hidden states #730) - #90

Merged
solderzzc merged 2 commits into
mainfrom
sync/upstream-efcedcd-merge
Oct 29, 2026
Merged

solderzzc merged 2 commits into
mainfrom
sync/upstream-efcedcd-merge

Conversation

@solderzzc

Copy link
Copy Markdown
Member

Summary

Conflict resolution (Libraries/MLXVLM/Models/Gemma4.swift)

  • streamExperts (StreamableMoE) kept from the fork.
  • Upstream's hiddenStates(_:) and multimodalInputs(_:) taken, with input.audio threaded through. The fork's audio source and audio tower stay in getInputEmbeddings, and prepare takes the audio branch.
  • Fork's per-layer-input (PLE) output masking in getInputEmbeddings kept. It came from fork commit 353c33a and is not in upstream or the merge base.
  • Gemma4Unified merged without conflict; its hiddenStates already passes audio.

Verification

  • Local: merge resolved and committed; no conflict markers left in the file. Local compile was not run (the Metal toolchain path is CI-only here).
  • CI on this PR is the gate. The new test is Tests/MLXLMTests/Gemma4VLMHiddenStatesTests.swift (added from upstream).

🤖 Generated with Claude Code

jonpol01 and others added 2 commits October 26, 2026 08:50
Add hiddenStates(_:) at @_spi(GemmaEncoder) on Gemma4 and Gemma4Unified. It
returns the text decoder's final-norm hidden states for an LMInput, built
through the same helper prepare now uses: soft tokens on their placeholder
rows, per-layer inputs, and the token types that drive bidirectional vision
attention. Clients can read the LM head's input from the loaded VLM without a
second, text-only model.
Pulls in Gemma 4 VLM hidden states (ml-explore#730). Conflicts resolved in
Libraries/MLXVLM/Models/Gemma4.swift:
- keep the fork's streamExperts (StreamableMoE) property;
- take upstream's hiddenStates(_:) and multimodalInputs(_:), with the audio
  input threaded through (fork-only audio source, Gemma4 audio tower);
- keep the fork's PLE output masking in getInputEmbeddings (fork commit 353c33a).

Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
@solderzzc
solderzzc merged commit 93bffe6 into main Oct 29, 2026
8 of 10 checks passed
@solderzzc
solderzzc deleted the sync/upstream-efcedcd-merge branch October 29, 2026 03:14
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.

2 participants