mirror of
https://github.com/p-e-w/heretic.git
synced 2026-12-03 18:42:57 +07:00
[GH-ISSUE #99] [Feature/Success Report with workaround] Support for Vision Models (Qwen2.5-VL) by switching to AutoModelForVision2Seq #53
Labels
No labels
bug
enhancement
enhancement
pull-request
question
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
p-e-w/heretic#53
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @Martossien on GitHub (Jan 4, 2026).
Original GitHub issue: https://github.com/p-e-w/heretic/issues/99
I wanted to report a successful uncensoring run on Qwen2.5-VL (a Vision Language Model for comfyui ) using heretic. While the tool currently defaults to AutoModelForCausalLM, this class does not support the architectural configuration of modern VLM models like Qwen-VL.
The Issue
When trying to load the model with the default code, it crashes with the following error:
"ValueError: Unrecognized configuration class <class 'transformers.models.qwen2_5_vl.configuration_qwen2_5_vl.Qwen2_5_VLConfig'> for this kind of AutoModel: AutoModelForCausalLM."
The Fix (Workaround)
I manually patched the installed package file (heretic/model.py) to use AutoModelForVision2Seq instead of "AutoModelForCausalLM."
"File location (pip install): .../site-packages/heretic/model.py"
Change:
"# Replaced:
from transformers import AutoModelForCausalLM, AutoTokenizer
"#" With:
from transformers import AutoModelForVision2Seq, AutoTokenizer
"#" ... and inside the reload_model() method:
"#" Replaced:
self.model = AutoModelForCausalLM.from_pretrained(...)
"#" With:
self.model = AutoModelForVision2Seq.from_pretrained(...)"
(Note: Transformers raised a warning suggesting AutoModelForImageTextToText for future versions, but AutoModelForVision2Seq worked perfectly for now).
Execution
I ran the command with the following flags (remote code trust is required for Qwen-VL):
heretic --model ./qwen_original --device-map "auto" --trust-remote-code true
Results
The abliteration process works flawlessly on the language components of the VLM, without breaking the vision capabilities.
Thanks for the great tool
@anrp commented on GitHub (Jan 15, 2026):
https://github.com/p-e-w/heretic/pull/108 fixes this