Downloads · 30 days
8
17% of all-time downloads
tugot17/LFM2-8B-A1B-5.2-packed
LFM2-8B-A1B-5.2-packed 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. The card lists the license as other.
This is a format conversion of LiquidAI/LFM2-8B-A1B, not a new model. The weights are numerically identical; only the MoE expert tensor layout differs.
Downloads · 30 days
8
17% of all-time downloads
All-time downloads
47
Public
Parameters
8.5B
16.9 GB on disk
Likes
0
Public
Click a slice to open those files.
.safetensors16.9 GB · 100%
How the weights are stored.
BF168.5B · 100%
From the Hugging Face model README
This is a format conversion of LiquidAI/LFM2-8B-A1B,
not a new model. The weights are numerically identical; only the MoE expert
tensor layout differs.
Transformers ≥ 5.0 (huggingface/transformers#41580) packs MoE expert weights into a single 3D tensor per projection instead of per-expert Linear weights:
| Original on-disk format | This repo (Transformers v5 packed) | |
|---|---|---|
| gate/up | …experts.{i}.w1.weight, …experts.{i}.w3.weight ([I, H] each) | …experts.gate_up_proj ([E, 2*I, H]) |
| down | …experts.{i}.w2.weight ([H, I]) | …experts.down_proj ([E, H, I]) |
For LFM2-8B-A1B: E=32, H=2048, I=1792, so
gate_up_proj is (32, 3584, 2048) and down_proj is (32, 2048, 1792)
— i.e. out-features-major, matching an inference engine's fused
w13_weight/w2_weight layout directly (no transpose needed).
This is the layout an in-memory Transformers v5 model exposes in its
state_dict, which is exactly what gets pushed over the
update_weights_from_tensor / RLHF weight-sync path. An inference-engine
weight loader that only understands the per-expert format will silently skip
these tensors, leaving experts uninitialized (garbage output). This repo is a
minimal reproducer / test fixture for that path (used to validate LFM2-MoE
packed-expert loading in SGLang).
from transformers import AutoModelForCausalLM # transformers >= 5.2
from safetensors.torch import save_file
import torch
m = AutoModelForCausalLM.from_pretrained("LiquidAI/LFM2-8B-A1B", dtype=torch.bfloat16)
sd = {k: v.contiguous().clone() for k, v in m.state_dict().items()}
save_file(sd, "model.safetensors", metadata={"format": "pt"})
Tokenizer and config are copied unchanged from the base model.