1
0
Fork 0
mirror of https://github.com/p-e-w/heretic.git synced 2026-12-03 18:42:57 +07:00

[PR #43] [CLOSED] add support for hybrid layer models: conv, mamba #250

Closed
opened 2026-11-01 04:19:13 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/p-e-w/heretic/pull/43
Author: @pszemraj
Created: 11/23/2025
Status: ❌ Closed

Base: master ← Head: hybrid-layer-support


📝 Commits (6)

  • c8c2238 feat: support hybrid stacks in abliteration with adaptive layer handling
  • b50b88e feat: support Granite modular variants and dynamic component discovery
  • 79f247d ✨feat: add LFM model variant support
  • 05e0571 filter extreme (>2) KL trials from list by default w option show_all_trials
  • 7090d65 clarify
  • 33a7fa2 fix: sanitize generation config before save/push

📊 Changes

3 files changed (+225 additions, -45 deletions)

View changed files

📝 src/heretic/config.py (+5 -0)
📝 src/heretic/main.py (+46 -15)
📝 src/heretic/model.py (+174 -30)

📄 Description

this PR adds support for new layer types: mamba, convolution layers as well as for hybrid layers (vary throughout model). This enables use for models like granite-4.0 , LFM2 etc.

  • Add LFM/LFM-MoE support: extract conv/MLP/expert projections, handle self_attn.out_proj, and enable trust_remote_code for LFM loaders.
  • Broaden component detection to cover Granite hybrid/shared MLP, Mixtral/JetMoE tensors, and mamba/conv layers; keep abliteration resilient when layers lack matrices.
  • Tune Optuna search ranges for hybrid/conv stacks and add optional filtering of high-KL (>2) trials in the selection menu (show_all_trials to disable).
  • Improve trial menu usability: sort by refusals (then KL), surface how many trials were filtered, and maintain original ordering otherwise.
  • fix: add basic generation-config sanitization so saves/uploads won’t fail (if the generation config is inconsistent/has issues, huggingface will now raise errors instead of saving/uploading... problematic in the CLI menu at the end)

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/p-e-w/heretic/pull/43 **Author:** [@pszemraj](https://github.com/pszemraj) **Created:** 11/23/2025 **Status:** ❌ Closed **Base:** `master` ← **Head:** `hybrid-layer-support` --- ### 📝 Commits (6) - [`c8c2238`](https://github.com/p-e-w/heretic/commit/c8c22382e0f5e322e8976159858e60070f088f52) feat: support hybrid stacks in abliteration with adaptive layer handling - [`b50b88e`](https://github.com/p-e-w/heretic/commit/b50b88e347b69cf9bfa3121475467f9621e6769d) feat: support Granite modular variants and dynamic component discovery - [`79f247d`](https://github.com/p-e-w/heretic/commit/79f247d3ee30bca8b6e29778f97347e4f9e4250c) ✨feat: add LFM model variant support - [`05e0571`](https://github.com/p-e-w/heretic/commit/05e05712ae5994db0ba9638faa43490c1462c8b3) filter extreme (>2) KL trials from list by default w option show_all_trials - [`7090d65`](https://github.com/p-e-w/heretic/commit/7090d6529985a89f1a7be4011d0f26454866d5dc) clarify - [`33a7fa2`](https://github.com/p-e-w/heretic/commit/33a7fa2bbe42c70f6a85637b4bc82babb170e681) fix: sanitize generation config before save/push ### 📊 Changes **3 files changed** (+225 additions, -45 deletions) <details> <summary>View changed files</summary> 📝 `src/heretic/config.py` (+5 -0) 📝 `src/heretic/main.py` (+46 -15) 📝 `src/heretic/model.py` (+174 -30) </details> ### 📄 Description this PR adds support for new layer types: mamba, convolution layers as well as for hybrid layers (vary throughout model). This enables use for models like granite-4.0 , LFM2 etc. - Add LFM/LFM-MoE support: extract conv/MLP/expert projections, handle self_attn.out_proj, and enable trust_remote_code for LFM loaders. - Broaden component detection to cover Granite hybrid/shared MLP, Mixtral/JetMoE tensors, and mamba/conv layers; keep abliteration resilient when layers lack matrices. - Tune Optuna search ranges for hybrid/conv stacks and add optional filtering of high-KL (>2) trials in the selection menu (show_all_trials to disable). - Improve trial menu usability: sort by refusals (then KL), surface how many trials were filtered, and maintain original ordering otherwise. - fix: add basic generation-config sanitization so saves/uploads won’t fail (_if the generation config is inconsistent/has issues, huggingface will now raise errors instead of saving/uploading... problematic in the CLI menu at the end_) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-01 04:19:13 +07:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
p-e-w/heretic#250
No description provided.