Native EmbeddingGemma 2 source subset

Source: https://github.com/Blaizzy/mlx-vlm
Revision: 3d87e88402f307efbf68e568971aa887ee7d9ed0
Copyright © 2025 Prince Canuma. Distributed under the MIT License (LICENSE).
The pinned repository license is MIT, not Apache-2.0; no license was relabeled.

Derived config.py, language.py and embedding_gemma2.py from
mlx_vlm/models/embedding_gemma2/; copied only EmbeddingOutput,
normalize_embeddings and mean_pooling from mlx_vlm/models/pooling.py.
Changes: namespace imports point to shipped MLX-VLM Gemma4/base helpers and
local pooling; type annotations and line formatting follow the host project's
lint rules. Original encoder math, projection and pooling are preserved.
The default text-only path removes media configurations, towers and feature
scattering from execution. Opt-in vision loading adapts the upstream image
feature/projector and soft-token scatter, using pinned Gemma4 vision helpers;
image preprocessing follows the validated media-only pilot. Audio is never
constructed and its weights are always filtered. Text-only loading also filters
vision weights, with unknown weights remaining subject to strict loading.
The serving text engine continues to reject all media tokens.
loader.py adapts the strict, quantized loading steps of the pinned
mlx_vlm/encoder_loader.py for this model with optional vision and disabled audio.
No global MLX-VLM registration or replacement is performed.
