Skip to content

Add SmolLM2 support (1.7B, 360M, 135M) - #175

Open
stikves wants to merge 5 commits into
apple:mainfrom
stikves:sukru/smollm2
Open

Add SmolLM2 support (1.7B, 360M, 135M)#175
stikves wants to merge 5 commits into
apple:mainfrom
stikves:sukru/smollm2

Conversation

@stikves

@stikves stikves commented Aug 15, 2026

Copy link
Copy Markdown
Contributor

Add HuggingFace SmolLM2 model family for macOS and iOS export:

  • 1.7B: INT4 quantized with FP16 embedding (tied weights)
  • 360M/135M: FP16 (small enough uncompressed)

SmolLM2 uses the Qwen2 architecture under a different model_type. Adds _model_type_override field to ModelPreset to route export without registering a global type mapping.

Custom quantization config keeps embedding/lm_head at FP16 because SmolLM2 ties these weights — INT4 on the shared tensor degrades long-form generation quality (+26% PPL vs +15% with FP16 embedding).

Add HuggingFace SmolLM2 model family for macOS and iOS export:
- 1.7B: INT4 quantized with FP16 embedding (tied weights)
- 360M/135M: FP16 (small enough uncompressed)

SmolLM2 uses the Qwen2 architecture under a different model_type.
Adds _model_type_override field to ModelPreset to route export
without registering a global type mapping.

Custom quantization config keeps embedding/lm_head at FP16 because
SmolLM2 ties these weights — INT4 on the shared tensor degrades
long-form generation quality (+26% PPL vs +15% with FP16 embedding).
stikves and others added 4 commits August 15, 2026 11:38
transformers 5.x requires rope_parameters to be a dict (not None)
when initializing Qwen2RotaryEmbedding. Pass rope_parameters and
rope_theta directly in the config constructor instead of setting
rope_scaling=None post-init.
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