google / google/gemma.cpp

Add SmolLM2 support — reuse the Qwen3 converter path?

Ouverte
#982 5 commentaires 0 réactions 0 personnes assignées Voir sur GitHub
Langage dominant
C++
Étoiles
7k
Forks
660
Merge moyen
20 h 43 min
PR mergées (30 j)
33

Description

Hi @jan-wassenberg — I'd like to contribute SmolLM2 (135M / 360M / 1.7B) support, and wanted to check the approach with you before writing any code.

SmolLM2 is plain Llama-style: RMSNorm, SwiGLU, RoPE theta 10000, no biases, no QK-norm, tied embeddings, byte-level BPE, ChatML turn tokens. As far as I can tell that needs **no new kernels** — everything is already on the Qwen3 path.

Sketch:

1. `python/convert_from_safetensors.py` — the HF tensor names are identical to Qwen3's, so `export_qwen3_lm_sbs` almost works as-is. The only blockers are the `has_qk_norm` assert and deriving `head_dim` from `q_norm.weight`. Plus a `smollm2-*` dispatch prefix.
2. `gemma/configs.{h,cc}` — new `Model` enum values + config functions.
3. `gemma/tokenizer.cc` — reuse the Qwen3 branch (same `<|im_start|>` / `<|im_end|>`).
4. `gemma/gemma.cc` — `HasEmbeddingScaling()` has to return false for it.

Questions:

- Is a third family outside Gemma/Qwen welcome here, or would you rather keep the model list narrow?
- Prefer a family-neutral `export_llama_style_lm_sbs` that both Qwen3 and SmolLM2 route through, or a separate function?
- For `HasEmbeddingScaling`, would you rather grow the per-family check, or add a `ModelConfig` field?

Happy to send a PR if the direction sounds right.

Guide de contribution

Ouvrir le guide de contribution

Piste de recherche

Read python/convert_from_safetensors.py and the existing Qwen3 path first, then inspect gemma/configs.{h,cc}, gemma/tokenizer.cc, and gemma/gemma.cc for model registration, token handling, and embedding scaling. Done means the maintainers have chosen the family and converter design, and SmolLM2 135M, 360M, and 1.7B support is implemented without new kernels.

Rédigé par le modèle d'indexation à partir du texte de l'issue.

Évaluation

Stack technique
cpp, python
Domaine
machine-learning
Type d'issue
Fonctionnalité
Difficulté
5/5
Temps estimé
Plus d'une semaine
Activité
Active
Clarté
Plutôt claire
Accessibilité débutants
38/100

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.