Downloads · 30 days
3
4% of all-time downloads
tugot17/lfm2-8b-a1b-smoltalk-lora-classic
lfm2-8b-a1b-smoltalk-lora-classic is a machine learning model from tugot17. Use it for the machine learning task on the model card, and read the license before you ship it in a product. It is set up for peft. The card lists the license as apache-2.0.
Per-expert (Mixtral-style) LoRA adapter for LiquidAI/LFM2-8B-A1B, produced by converting the LiquidAI/LFM2-8B-A1B-smoltalk-LoRA adapter (trained via PEFT 0.18+'s targetparameters on the batched 3D MoE expert tensors)…
Downloads · 30 days
3
4% of all-time downloads
All-time downloads
71
Public
Repo size
538 MB
Likes
0
Public
Click a slice to open those files.
.safetensors273 MB · 98%
From the Hugging Face model README
Per-expert (Mixtral-style) LoRA adapter for LiquidAI/LFM2-8B-A1B, produced by converting the LiquidAI/LFM2-8B-A1B-smoltalk-LoRA adapter (trained via PEFT 0.18+'s target_parameters on the batched 3D MoE expert tensors) into the classic per-expert layout (...mlp.experts.<N>.gate_proj/up_proj/down_proj.lora_*).
The conversion is mathematically lossless — PEFT's fused-parameter LoRA over experts.gate_up_proj decomposes into per-expert (A, B_gate || B_up) blocks; only the expert tensors are repacked, every other weight is carried over verbatim. See convert_lfm2_moe_lora_to_per_expert.py.
q_proj, k_proj, v_proj, out_projin_proj, out_projgate_proj, up_proj, down_proj (renamed from LFM2-native w1/w3/w2)gategate_proj, up_proj, down_projr=8, alpha=16, num_experts=32, hidden=2048, moe_intermediate=1792. Per-expert gate and up share lora_A (PEFT's fused training has a single shared A; splitting B's output axis into gate || up halves and keeping A common is the per-expert equivalent).
Requires SGLang with the LFM2 LoRA wiring patch (tugot17/sglang#10). Once it lands upstream, stock SGLang works.
sglang serve \
--model-path LiquidAI/LFM2-8B-A1B \
--port 30000 \
--enable-lora --max-lora-rank 8 \
--lora-paths "smoltalk=tugot17/lfm2-8b-a1b-smoltalk-lora-classic" \
--lora-target-modules q_proj k_proj v_proj out_proj gate_proj up_proj down_proj in_proj gate \
--lora-strict-loading
Generate with LoRA:
curl -sS http://localhost:30000/generate \
-H "Content-Type: application/json" \
-d '{
"text": "Write a short story set in an unusual location.",
"sampling_params": {"temperature": 0.0, "max_new_tokens": 80},
"lora_path": "smoltalk"
}'
Verified against HF+PEFT running the original, unfiltered adapter, by teacher-forced top-k
logprob comparison (greedy, bf16): SGLang's 32-token generation is token-identical to HF and
the logprob divergence (prefill mean 0.22 / max 0.77; decode mean 0.28 / max 0.87) is well below
the base model's no-LoRA kernel-noise floor (prefill 0.37/1.50; decode 0.40/1.75). The expert-tensor
repacking was additionally checked against PEFT's own merge_and_unload deltas — they match
scale·(B@A) per expert to bf16 rounding (max abs err 5e-4).
huggingface-cli download tugot17/lfm2-8b-a1b-smoltalk-lora-classic convert_lfm2_moe_lora_to_per_expert.py --local-dir .
huggingface-cli download LiquidAI/LFM2-8B-A1B-smoltalk-LoRA --local-dir ./src
python convert_lfm2_moe_lora_to_per_expert.py --src ./src --dst ./out
Only depends on torch and safetensors.
Per the parent adapter card: r=8, alpha=16, dropout=0, 3 epochs on a 5000-sample slice of HuggingFaceTB/smoltalk. All numbers carry over — the conversion doesn't change the LoRA semantics.