Add support for LFM2 hybrid attention-convolution architecture#126
Add support for LFM2 hybrid attention-convolution architecture#126noctrex wants to merge 0 commit intop-e-w:masterfrom
Conversation
Summary of ChangesHello @noctrex, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request enhances the Highlights
🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console. Changelog
Activity
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request adds support for the LFM2 hybrid attention-convolution architecture by adding fallback paths to find the correct modules for attention, convolution, and MLP layers. The changes correctly identify alternative attribute names in LFM2 models. My review includes a suggestion to make the implementation more robust by ensuring the fallback paths are mutually exclusive, which will prevent potential issues with future model architectures.
|
Thanks for the PR! Note that there is already a PR (#43) that implements support for hybrid models. Perhaps you want to check that PR for verification and potentially relevant ideas. What results are you getting from abliterating LFM2? Have you uploaded the model to Hugging Face? |
Oh sorry must have missed it. I'll try that one to make some experiment on LFM2, cause mine does not work very well. |
LFM2 models use alternating convolution and attention layers with different attribute names than standard transformer models. This change adds fallback paths to handle LFM2's structure:
self_attn.out_projfor attention layers (vso_proj)conv.out_projfor convolution layersfeed_forward.w2for MLP (vsmlp.down_proj)All attribute accesses are now wrapped in exception suppression to gracefully handle different model architectures. This enables heretic to work with LFM2's hybrid architecture without skipping any layers.