mirror of
https://github.com/p-e-w/heretic.git
synced 2026-12-03 18:42:57 +07:00
[GH-ISSUE #18] Qwen3 32b VL support? #8
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#8
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 @phr00t on GitHub (Nov 18, 2025).
Original GitHub issue: https://github.com/p-e-w/heretic/issues/18
Perhaps related to https://github.com/p-e-w/heretic/pull/11 ?
torch-2.9.1+cu130
Name: transformers
Version: 4.57.1
`phr00t@AI-BOT /cygdrive/d/Heretic
$ heretic Qwen/Qwen3-VL-32B-Instruct
█░█░█▀▀░█▀▄░█▀▀░▀█▀░█░█▀▀ v1.0.1
█▀█░█▀▀░█▀▄░█▀▀░░█░░█░█░░
▀░▀░▀▀▀░▀░▀░▀▀▀░░▀░░▀░▀▀▀ https://github.com/p-e-w/heretic
GPU type: NVIDIA GeForce RTX 5070 Ti
Loading model Qwen/Qwen3-VL-32B-Instruct...
tokenizer_config.json: 10.9kB [00:00, ?B/s]
C:\Users\phr00t\AppData\Roaming\Python\Python312\site-packages\huggingface_hub\file_download.py:143: UserWarning:
huggingface_hubcache-system uses symlinks by default to efficiently store duplicated files but your machine does not support them in C:\Users\phr00t.cache\huggingface\hub\models--Qwen--Qwen3-VL-32B-Instruct. Caching files will still work but in a degraded version that might require more space on your disk. This warning can be disabled by setting theHF_HUB_DISABLE_SYMLINKS_WARNINGenvironment variable. For more details, see https://huggingface.co/docs/huggingface_hub/how-to-cache#limitations.To support symlinks on Windows, you either need to activate Developer Mode or to run Python as an administrator. In order to activate developer mode, see this article: https://docs.microsoft.com/en-us/windows/apps/get-started/enable-your-device-for-development
warnings.warn(message)
vocab.json: 2.78MB [00:00, 11.4MB/s]
merges.txt: 1.67MB [00:00, 12.2MB/s]
tokenizer.json: 7.03MB [00:00, 18.9MB/s]
config.json: 1.47kB [00:00, ?B/s]
Failed (Unrecognized configuration class <class 'transformers.models.qwen3_vl.configuration_qwen3_vl.Qwen3VLConfig'> for this
kind of AutoModel: AutoModelForCausalLM.
Model type should be one of ApertusConfig, ArceeConfig, AriaTextConfig, BambaConfig, BartConfig, BertConfig,
BertGenerationConfig, BigBirdConfig, BigBirdPegasusConfig, BioGptConfig, BitNetConfig, BlenderbotConfig, BlenderbotSmallConfig,
BloomConfig, BltConfig, CamembertConfig, LlamaConfig, CodeGenConfig, CohereConfig, Cohere2Config, CpmAntConfig, CTRLConfig,
Data2VecTextConfig, DbrxConfig, DeepseekV2Config, DeepseekV3Config, DiffLlamaConfig, DogeConfig, Dots1Config, ElectraConfig,
Emu3Config, ErnieConfig, Ernie4_5Config, Ernie4_5_MoeConfig, Exaone4Config, FalconConfig, FalconH1Config, FalconMambaConfig,
FlexOlmoConfig, FuyuConfig, GemmaConfig, Gemma2Config, Gemma3Config, Gemma3TextConfig, Gemma3nConfig, Gemma3nTextConfig,
GitConfig, GlmConfig, Glm4Config, Glm4MoeConfig, GotOcr2Config, GPT2Config, GPT2Config, GPTBigCodeConfig, GPTNeoConfig,
GPTNeoXConfig, GPTNeoXJapaneseConfig, GptOssConfig, GPTJConfig, GraniteConfig, GraniteMoeConfig, GraniteMoeHybridConfig,
GraniteMoeSharedConfig, HeliumConfig, HunYuanDenseV1Config, HunYuanMoEV1Config, JambaConfig, JetMoeConfig, Lfm2Config,
LlamaConfig, Llama4Config, Llama4TextConfig, LongcatFlashConfig, MambaConfig, Mamba2Config, MarianConfig, MBartConfig,
MegaConfig, MegatronBertConfig, MiniMaxConfig, MinistralConfig, MistralConfig, MixtralConfig, MllamaConfig,
ModernBertDecoderConfig, MoshiConfig, MptConfig, MusicgenConfig, MusicgenMelodyConfig, MvpConfig, NemotronConfig, OlmoConfig,
Olmo2Config, Olmo3Config, OlmoeConfig, OpenLlamaConfig, OpenAIGPTConfig, OPTConfig, PegasusConfig, PersimmonConfig, PhiConfig,
Phi3Config, Phi4MultimodalConfig, PhimoeConfig, PLBartConfig, ProphetNetConfig, QDQBertConfig, Qwen2Config, Qwen2MoeConfig,
Qwen3Config, Qwen3MoeConfig, Qwen3NextConfig, RecurrentGemmaConfig, ReformerConfig, RemBertConfig, RobertaConfig,
RobertaPreLayerNormConfig, RoCBertConfig, RoFormerConfig, RwkvConfig, SeedOssConfig, SmolLM3Config, Speech2Text2Config,
StableLmConfig, Starcoder2Config, TransfoXLConfig, TrOCRConfig, VaultGemmaConfig, WhisperConfig, XGLMConfig, XLMConfig,
XLMProphetNetConfig, XLMRobertaConfig, XLMRobertaXLConfig, XLNetConfig, xLSTMConfig, XmodConfig, ZambaConfig, Zamba2Config.)
kind of AutoModel: AutoModelForCausalLM.
Model type should be one of ApertusConfig, ArceeConfig, AriaTextConfig, BambaConfig, BartConfig, BertConfig,
BertGenerationConfig, BigBirdConfig, BigBirdPegasusConfig, BioGptConfig, BitNetConfig, BlenderbotConfig, BlenderbotSmallConfig,
BloomConfig, BltConfig, CamembertConfig, LlamaConfig, CodeGenConfig, CohereConfig, Cohere2Config, CpmAntConfig, CTRLConfig,
Data2VecTextConfig, DbrxConfig, DeepseekV2Config, DeepseekV3Config, DiffLlamaConfig, DogeConfig, Dots1Config, ElectraConfig,
Emu3Config, ErnieConfig, Ernie4_5Config, Ernie4_5_MoeConfig, Exaone4Config, FalconConfig, FalconH1Config, FalconMambaConfig,
FlexOlmoConfig, FuyuConfig, GemmaConfig, Gemma2Config, Gemma3Config, Gemma3TextConfig, Gemma3nConfig, Gemma3nTextConfig,
GitConfig, GlmConfig, Glm4Config, Glm4MoeConfig, GotOcr2Config, GPT2Config, GPT2Config, GPTBigCodeConfig, GPTNeoConfig,
GPTNeoXConfig, GPTNeoXJapaneseConfig, GptOssConfig, GPTJConfig, GraniteConfig, GraniteMoeConfig, GraniteMoeHybridConfig,
GraniteMoeSharedConfig, HeliumConfig, HunYuanDenseV1Config, HunYuanMoEV1Config, JambaConfig, JetMoeConfig, Lfm2Config,
LlamaConfig, Llama4Config, Llama4TextConfig, LongcatFlashConfig, MambaConfig, Mamba2Config, MarianConfig, MBartConfig,
MegaConfig, MegatronBertConfig, MiniMaxConfig, MinistralConfig, MistralConfig, MixtralConfig, MllamaConfig,
ModernBertDecoderConfig, MoshiConfig, MptConfig, MusicgenConfig, MusicgenMelodyConfig, MvpConfig, NemotronConfig, OlmoConfig,
Olmo2Config, Olmo3Config, OlmoeConfig, OpenLlamaConfig, OpenAIGPTConfig, OPTConfig, PegasusConfig, PersimmonConfig, PhiConfig,
Phi3Config, Phi4MultimodalConfig, PhimoeConfig, PLBartConfig, ProphetNetConfig, QDQBertConfig, Qwen2Config, Qwen2MoeConfig,
Qwen3Config, Qwen3MoeConfig, Qwen3NextConfig, RecurrentGemmaConfig, ReformerConfig, RemBertConfig, RobertaConfig,
RobertaPreLayerNormConfig, RoCBertConfig, RoFormerConfig, RwkvConfig, SeedOssConfig, SmolLM3Config, Speech2Text2Config,
StableLmConfig, Starcoder2Config, TransfoXLConfig, TrOCRConfig, VaultGemmaConfig, WhisperConfig, XGLMConfig, XLMConfig,
XLMProphetNetConfig, XLMRobertaConfig, XLMRobertaXLConfig, XLNetConfig, xLSTMConfig, XmodConfig, ZambaConfig, Zamba2Config.)
kind of AutoModel: AutoModelForCausalLM.
Model type should be one of ApertusConfig, ArceeConfig, AriaTextConfig, BambaConfig, BartConfig, BertConfig,
BertGenerationConfig, BigBirdConfig, BigBirdPegasusConfig, BioGptConfig, BitNetConfig, BlenderbotConfig, BlenderbotSmallConfig,
BloomConfig, BltConfig, CamembertConfig, LlamaConfig, CodeGenConfig, CohereConfig, Cohere2Config, CpmAntConfig, CTRLConfig,
Data2VecTextConfig, DbrxConfig, DeepseekV2Config, DeepseekV3Config, DiffLlamaConfig, DogeConfig, Dots1Config, ElectraConfig,
Emu3Config, ErnieConfig, Ernie4_5Config, Ernie4_5_MoeConfig, Exaone4Config, FalconConfig, FalconH1Config, FalconMambaConfig,
FlexOlmoConfig, FuyuConfig, GemmaConfig, Gemma2Config, Gemma3Config, Gemma3TextConfig, Gemma3nConfig, Gemma3nTextConfig,
GitConfig, GlmConfig, Glm4Config, Glm4MoeConfig, GotOcr2Config, GPT2Config, GPT2Config, GPTBigCodeConfig, GPTNeoConfig,
GPTNeoXConfig, GPTNeoXJapaneseConfig, GptOssConfig, GPTJConfig, GraniteConfig, GraniteMoeConfig, GraniteMoeHybridConfig,
GraniteMoeSharedConfig, HeliumConfig, HunYuanDenseV1Config, HunYuanMoEV1Config, JambaConfig, JetMoeConfig, Lfm2Config,
LlamaConfig, Llama4Config, Llama4TextConfig, LongcatFlashConfig, MambaConfig, Mamba2Config, MarianConfig, MBartConfig,
MegaConfig, MegatronBertConfig, MiniMaxConfig, MinistralConfig, MistralConfig, MixtralConfig, MllamaConfig,
ModernBertDecoderConfig, MoshiConfig, MptConfig, MusicgenConfig, MusicgenMelodyConfig, MvpConfig, NemotronConfig, OlmoConfig,
Olmo2Config, Olmo3Config, OlmoeConfig, OpenLlamaConfig, OpenAIGPTConfig, OPTConfig, PegasusConfig, PersimmonConfig, PhiConfig,
Phi3Config, Phi4MultimodalConfig, PhimoeConfig, PLBartConfig, ProphetNetConfig, QDQBertConfig, Qwen2Config, Qwen2MoeConfig,
Qwen3Config, Qwen3MoeConfig, Qwen3NextConfig, RecurrentGemmaConfig, ReformerConfig, RemBertConfig, RobertaConfig,
RobertaPreLayerNormConfig, RoCBertConfig, RoFormerConfig, RwkvConfig, SeedOssConfig, SmolLM3Config, Speech2Text2Config,
StableLmConfig, Starcoder2Config, TransfoXLConfig, TrOCRConfig, VaultGemmaConfig, WhisperConfig, XGLMConfig, XLMConfig,
XLMProphetNetConfig, XLMRobertaConfig, XLMRobertaXLConfig, XLNetConfig, xLSTMConfig, XmodConfig, ZambaConfig, Zamba2Config.)
╭─────────────────────────────── Traceback (most recent call last) ────────────────────────────────╮
│ in _run_module_as_main:198 │
│ in _run_code:88 │
│ │
│ in :7 │
│ │
│ 4 from heretic.main import main │
│ 5 if name == 'main': │
│ 6 │ sys.argv[0] = re.sub(r'(-script.pyw|.exe)?$', '', sys.argv[0]) │
│ ❱ 7 │ sys.exit(main()) │
│ 8 │
│ │
│ C:\Users\phr00t\AppData\Roaming\Python\Python312\site-packages\heretic\main.py:506 in main │
│ │
│ 503 │ install() │
│ 504 │ │
│ 505 │ try: │
│ ❱ 506 │ │ run() │
│ 507 │ except BaseException as error: │
│ 508 │ │ # Transformers appears to handle KeyboardInterrupt (or BaseException) │
│ 509 │ │ # internally in some places, which can re-raise a different error in the handler │
│ │
│ C:\Users\phr00t\AppData\Roaming\Python\Python312\site-packages\heretic\main.py:116 in run │
│ │
│ 113 │ # Silence the warning about multivariate TPE being experimental. │
│ 114 │ warnings.filterwarnings("ignore", category=ExperimentalWarning) │
│ 115 │ │
│ ❱ 116 │ model = Model(settings) │
│ 117 │ │
│ 118 │ print() │
│ 119 │ print(f"Loading good prompts from [bold]{settings.good_prompts.dataset}[/]...") │
│ │
│ C:\Users\phr00t\AppData\Roaming\Python\Python312\site-packages\heretic\model.py:76 in init │
│ │
│ 73 │ │ │ break │
│ 74 │ │ │
│ 75 │ │ if self.model is None: │
│ ❱ 76 │ │ │ raise Exception("Failed to load model with all configured dtypes.") │
│ 77 │ │ │
│ 78 │ │ print(f"* Transformer model with [bold]{len(self.get_layers())}[/] layers") │
│ 79 │ │ print("* Abliterable components:") │
╰──────────────────────────────────────────────────────────────────────────────────────────────────╯
Exception: Failed to load model with all configured dtypes.`
@yxtann commented on GitHub (Nov 18, 2025):
I manually added the
Qwen3VLForConditionalGenerationandAutoProcessorin, and did a hacky nested try except to get it to load the VL model. You can refer here formodel.py@p-e-w commented on GitHub (Nov 18, 2025):
I don't get it. How does that normally work then? I'm using the bog standard Transformer loading method that is supposed to work with all models. From their model card, it appears that they indeed don't support
AutoModelForCausalLM.@yxtann commented on GitHub (Nov 18, 2025):
There might have been a proper fix here in the
transformerslibrary, but I don't think it is pushed to the official releases. I'm not sure though, did not test the Heretic repo with the latest transformers main branch. I'm usingtransformers==4.57.1currently.https://github.com/huggingface/transformers/pull/42059
@jeancmyk commented on GitHub (Nov 19, 2025):
I was able to modify the model.py file as described below, and it worked so I abliterated qwen3 4b vl using your method. Will upload to HF later. I used gemini 3 to fix this, and have no idea how or why it works. EDIT: I am running this in a virtual environment on Win 11 using Python 3.12.9 PyTorch Nightly Build 2.5.1+cu121 (bc rtx 5090) CUDA 12.1.
https://huggingface.co/JSon-AI/Qwen3-VL-4B-Instruct-Abliterated-heretic
Also attached the updated model.py below. Thanks for developing this user-friendly tool!
Issue:
The tool currently hardcodes
AutoModelForCausalLM. This causes a crash when trying to load Vision-Language models (e.g.,Qwen/Qwen3-VL-4B-Instruct) which requireAutoModelForVision2Seq. Additionally,reload_model()hardcodes the loader, which causes the tool to crash during the optimization phase even if the initial load succeeds.Solution:
AutoModelForVision2Seq.__init__to try the Vision loader if the CausalLM loader fails.reload_modelto dynamically use the active model's class instead of hardcoding the loader.Changes in
model.py:1. Update Imports
2. Update
__init__(Fallback Logic)Replace the existing loading loop with:
3. Update
reload_model(Dynamic Class Loading)Replace the
reload_modelmethod with:model_modified.py
@p-e-w commented on GitHub (Nov 19, 2025):
@jeancmyk
Thanks for the effort, but I think the correct solution here is to wait for Transformers to fix this upstream.
AutoModelForCausalLMis the officially blessed mechanism that is supposed to load any model that contains a generative language model. This also works for most multimodal models such as Gemma 3. The fact that it doesn't load Qwen3 VL is a defect in Transformers, and should be addressed there.I'm going to wait a few months, and if Transformers doesn't address this, I'll revisit and consider adopting your workaround.
@coder3101 commented on GitHub (Nov 22, 2025):
https://huggingface.co/coder3101/Qwen3-VL-32B-Instruct-Heretic
EDIT: I abliterated bunch of other models in Qwen3VL - here you go!
@TomLucidor commented on GitHub (Dec 10, 2025):
If this is real, then Qwen-Image-Edit and SAM3 would be free to detect things too, no?
@raziel2001au commented on GitHub (Dec 21, 2025):
It's not going to get 'fixed', from my understanding, for VL models, you are supposed to use 'AutoModelForImageTextToText' rather than the normal 'AutoModelForCausalLM', for more information, refer to the documentation on image text to text (i.e. VL models): https://huggingface.co/docs/transformers/main/tasks/image_text_to_text
@p-e-w commented on GitHub (Jan 23, 2026):
Fixed by @anrp in #108.