Skip to content

lfm2: strip lm_head.weight for tied embeddings#1055

Draft
ykhrustalev wants to merge 1 commit intoml-explore:mainfrom
ykhrustalev:main
Draft

lfm2: strip lm_head.weight for tied embeddings#1055
ykhrustalev wants to merge 1 commit intoml-explore:mainfrom
ykhrustalev:main

Conversation

@ykhrustalev
Copy link
Copy Markdown
Contributor

No description provided.

The lfm2 model always uses tied embeddings (embed_tokens.as_linear),
but some checkpoints (e.g. LiquidAI/LFM2.5-350M) ship a separate
lm_head.weight in their safetensors. This causes load_weights to
raise "Received 1 parameters not in model: lm_head.weight".

Strip lm_head.weight in sanitize, matching the pattern already used
by llama, mixtral, and qwen3_moe.
@ykhrustalev
Copy link
Copy Markdown
Contributor Author

cc @Blaizzy

Copy link
Copy Markdown
Contributor

@Blaizzy Blaizzy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you share what model weights have lm_head?

Because this model by default shouldn't have lm_head because it has tied word embeddings.

@ykhrustalev
Copy link
Copy Markdown
Contributor Author

@Blaizzy you are right, the checkpoint I am using is little different, I will check and come back.

@ykhrustalev ykhrustalev marked this pull request as draft March 25, 2026 21:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants