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
fix(gemma3n): support per-layer intermediate_size array (#46)
* fix(gemma3n): support per-layer intermediate_size array
Gemma 3n models from HuggingFace specify intermediate_size as an array
(one value per layer) rather than a single integer. This causes a decoding
error when trying to load these models.
This commit introduces an IntOrArray type that can decode either format,
maintaining backwards compatibility with models that use a single value
while adding support for the per-layer array format.
Fixes loading of models like:
- mlx-community/gemma-3n-E2B-it-4bit
- mlx-community/gemma-3n-E4B-it-4bit
Tested with swift build - compiles successfully.
* fix(gemma3n): make query_pre_attn_scalar optional
Some HuggingFace Gemma 3n configs don't include this field.
* fix(gemma3n): preserve all weights in sanitize function
The sanitize function was only keeping weights with 'model.language_model.'
prefix and discarding all others. This caused missing weight errors when
loading Gemma 3n models.
0 commit comments