Add SmolLM2 support — reuse the Qwen3 converter path?
- 主要语言
- C++
- 星标
- 7k
- 派生
- 660
- 平均合并
- 20 小时 43 分钟
- 30 天内合并 PR
- 33
描述
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.
贡献指南
调研方向
先阅读 python/convert_from_safetensors.py 和现有的 Qwen3 路径,然后检查 gemma/configs.{h,cc}、gemma/tokenizer.cc 和 gemma/gemma.cc,以了解模型注册、token 处理和 embedding 缩放。完成的标准是维护者已经选定模型系列和 converter 设计,并且已在不新增 kernel 的情况下实现对 SmolLM2 135M、360M 和 1.7B 的支持。
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- cpp, python
- 领域
- machine-learning
- Issue 类型
- 功能
- 难度
- 5/5
- 预计耗时
- 一周以上
- 活跃度
- 活跃
- 描述清晰度
- 基本清楚
- 新手友好度
- 38/100