mirror of
https://github.com/p-e-w/heretic.git
synced 2026-12-03 18:42:57 +07:00
[GH-ISSUE #380] Heretic quits before loading Gemma 4 12B QAT model #197
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#197
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 @romano on GitHub (Jun 15, 2026).
Original GitHub issue: https://github.com/p-e-w/heretic/issues/380
I've been trying to use Heretic on Gemma 4 12B QAT for a few days, and it fails every time. Initially I tried using embedded Python, but now I'm using venv, as recommended.
Screenshot:
Installation process:
python -m venv venv
venv/Scripts/activate
pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu130
pip install -U heretic-llm
I'd imagine that this is the proper way of installing Heretic along with CUDA enabled PyTorch.
Versions:
Windows 11 Pro 25H2 (26200.8655)
NVIDIA driver 610.47
Python 3.14.6
Heretic 1.4.0
Hardware:
NVIDIA GeForce RTX 4080 SUPER 16GB
AMD Ryzen 7 7800X3D
32GB RAM DDR5
Config.toml:
Things that I tried:
In short, I'm at a loss. It throws no error, and I have no clue what's wrong. I can see that the model is starting to get loaded, as the VRAM usage starts to rise, before dropping back to normal and Heretic just quits. What's interesting, models like Qwen3.5-4B load just fine. Is it a memory limitation? Hardware incompatibility? User error?
@umran666 commented on GitHub (Jun 16, 2026):
Hey! This looks like a classic silent crash caused by Windows hitting its memory commit limit during the mmap phase.
Even though you have 32GB of DDR5 and a 16GB GPU, transformers uses a library called safetensors (written in Rust) which tries to memory-map (mmap) the entire model into virtual memory before it starts moving things to the GPU.
A 12B model takes about 24GB to map. Windows uses about 6-8GB of RAM just sitting idle. (24 + 8 = 32). The exact millisecond the safetensors backend tries to map the 24GB model, it hits the 32GB hard ceiling of your system. Instead of throwing a polite Python error, the Rust backend panics and instantly terminates the Python process (which is why you get dropped straight back to the PowerShell prompt at 0/677 without an error log).
Qwen-4B works perfectly because it's only 8GB, which easily fits inside your 32GB limit.
The Fix: You need to manually increase your Windows Virtual Memory (Page File).
Hit the Windows key and type Advanced system settings.
Go to the Advanced tab -> Performance -> Settings.
Go to the Advanced tab -> Virtual memory -> Change.
Uncheck 'Automatically manage' and set a Custom size for your main drive. Set the Initial size to 32000 (32GB) and Maximum size to 64000 (64GB).
Restart your PC.
Once Windows has that extra 64GB of virtual commit space to work with, safetensors will stop panicking, the model will successfully load into RAM, get quantized by bitsandbytes, and then ship over to your 4080.
@romano commented on GitHub (Jun 16, 2026):
That was it. I had no idea that the whole model would be mmapped into my system RAM. The memory limits I've set, with 13GB of VRAM and 25GB of system RAM add up to 38GB, so I thought that I could safely load the model, even unquantized. I guess my confusion stems from being able to run models that are way bigger, but I admit that I always disabled mmap. Thanks @umran666, this fixes it.
EDIT: As a sidenote, this begs for an error that hints on what the problem might be. I'm sure that I'm not the only one scratching my head and wondering if it's just not possible.
@umran666 commented on GitHub (Jun 16, 2026):
Yeah, the whole mmap thing is super sneaky on Windows if you're not expecting it, so it catches a lot of people
@p-e-w commented on GitHub (Jun 16, 2026):
We can't do that. It's the Python interpreter that crashes, not Heretic. We don't get a chance to show an error here.
Anyway, closing this issue as this is not our bug.