Open
Conversation
Author
|
@microsoft-github-policy-service agree [company="{Liquid AI}"] |
Author
|
@microsoft-github-policy-service agree company="Liquid AI" |
LFM2 is a hybrid SSM+Attention model where conv layers lack self_attn. The existing fail_on_not_found=False for attention (added for Qwen3.5) handles the missing self_attn gracefully, but LFM2 needs its own submodule name mappings since it uses non-standard names (operator_norm, ffn_norm, feed_forward, w1/w2/w3, out_proj). Also fix fuse_ln_linear in rotate.py to skip resetting layernorm weights when no linear layers were fused (prevents corrupting conv layer norms in hybrid models).
1995c5a to
6560590
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Describe your changes
Add LFM2 hybrid model support. LFM2 interleaves attention and conv layers — conv layers lack
self_attn.wrapper.py: Add
"lfm2"submodule name mappings toLayerWrapper(layer norms, MLP, attention output) andModelWrapper(PRE_HEAD_LAYERNORM). LFM2 uses non-standard names (operator_norm,ffn_norm,feed_forward,w1/w2/w3,out_proj,embedding_norm).rotate.py: Skip
fuse_ln_linearwhen no linears are passed. Previously it reset layernorm weights to 1.0 even with an empty list, corrupting conv layer norms.test_hf_wrapper.py: Add test using
tiny-random/lfm2— verifies both attention and conv layers resolve correctly.Checklist before requesting a review
lintrunner -aRelease note: Added LFM2 hybrid model support for quantization passes (SelectiveMixedPrecision, QuaRot/SpinQuant).
(Optional) Issue link
N/A