Add DeepSeek-R1-Distill-Qwen (1.5B / 7B / 14B / 32B) model configs
LitGPT has the two Llama-based R1 distills (R1-Distill-Llama-8B, R1-Distill-Llama-70B, added in #1922), but not the four Qwen-based ones:
deepseek-ai/DeepSeek-R1-Distill-Qwen-1.5Bdeepseek-ai/DeepSeek-R1-Distill-Qwen-7Bdeepseek-ai/DeepSeek-R1-Distill-Qwen-14Bdeepseek-ai/DeepSeek-R1-Distill-Qwen-32B
The 1.5B and 7B are common starting points for reasoning fine-tuning and RL experiments, and they are small enough for single-GPU work (the 7B peaked at 15.6 GB in a bf16 litgpt generate run).
All four are Qwen2ForCausalLM checkpoints, and LitGPT already has their architectures: the 14B/32B match the Qwen2.5-14B/Qwen2.5-32B configs, and the 1.5B/7B match Qwen2.5-Math-1.5B/-7B except for context length. No modeling code is needed.
Today litgpt download deepseek-ai/DeepSeek-R1-Distill-Qwen-7B is rejected as an unsupported repo_id. The suggested workaround, --model_name Qwen2.5-Math-7B, does convert the weights. But the checkpoint then carries a Qwen2.5 config name, so it gets the ChatML prompt style instead of the R1 format (R1Base), and the 1.5B/7B get block_size=4096, which caps prompt plus generation at 4096 tokens.
Adding only a config is not enough either. Conversion then falls through to the Llama weight copier, which has no q/k/v bias entries, and fails with KeyError: 'model.layers.{}.self_attn.q_proj.bias'.
Proposed change:
- Add four entries to
litgpt/config.pynext to the R1-Distill-Llama ones, using each repo'sconfig.json. - Route these names to the Qwen2.5 weight copiers in
convert_hf_checkpoint.pyandconvert_lit_checkpoint.py, the same way QwQ was added. - Add the names to the existing Qwen2 tests, the README model list and the download tutorial.
R1Base already matches these names, and the tokenizer already handles their BOS setup, so neither needs a change. I have this implemented and checked against HF transformers with the real 1.5B and 7B weights. I'm happy to open the PR if this is welcome.
Source: Lightning-AI/litgpt