When using the latest comfyui-gguf 2.0.0 on Windows, I get a crash:
plaintext
Windows fatal exception: access violation
Reproduce step
Modify the UnetLoaderGGUF node to return two outputs: (MODEL, STRING)
After generating images, ComfyUI will automatically trigger unpatch_model
Crash occurs inside GGUFModelPatcher.unpatch_model
Root cause
GGUF quantized weights use mmap memory mapping.
When passing unpatch_weights=True to super().unpatch_model,
the base model patcher tries to operate directly on GGUF raw tensor memory,
causing Windows memory access violation and instant crash.
Fix solution
Only one line needs to be modified:
Original line:
python:
return super().unpatch_model(device_to=device_to, unpatch_weights=unpatch_weights)
Fixed line:
python:
return super().unpatch_model(device_to=device_to, unpatch_weights=False)
Why this fix works
Set unpatch_weights=False to avoid the base patcher touching GGUF mmap weight memory.
Model can still unload normally when switching models, no memory leak.
No crash, all original GGUF functions keep working perfectly.
This is a regression bug in 2.0.0, the fix was already applied in old version 1.1.6 but missed in the refactored 2.0.0 code.
When using the latest comfyui-gguf 2.0.0 on Windows, I get a crash:
plaintext
Windows fatal exception: access violation
Reproduce step
Modify the UnetLoaderGGUF node to return two outputs: (MODEL, STRING)
After generating images, ComfyUI will automatically trigger unpatch_model
Crash occurs inside GGUFModelPatcher.unpatch_model
Root cause
GGUF quantized weights use mmap memory mapping.
When passing unpatch_weights=True to super().unpatch_model,
the base model patcher tries to operate directly on GGUF raw tensor memory,
causing Windows memory access violation and instant crash.
Fix solution
Only one line needs to be modified:
Original line:
python:
return super().unpatch_model(device_to=device_to, unpatch_weights=unpatch_weights)
Fixed line:
python:
return super().unpatch_model(device_to=device_to, unpatch_weights=False)
Why this fix works
Set unpatch_weights=False to avoid the base patcher touching GGUF mmap weight memory.
Model can still unload normally when switching models, no memory leak.
No crash, all original GGUF functions keep working perfectly.
This is a regression bug in 2.0.0, the fix was already applied in old version 1.1.6 but missed in the refactored 2.0.0 code.