GGUF vram OOM
- Dominant language
- Python
- Stars
- 133k
- Forks
- 15.7k
- Avg merge
- 1d 7h
- Merged PRs (30d)
- 158
Description
### Custom Node Testing
- [x] I have tried disabling custom nodes and the issue persists (see [how to disable custom nodes](https://docs.comfy.org/troubleshooting/custom-node-issues#step-1%3A-test-with-all-custom-nodes-disabled) if you need help)
### Expected Behavior
when running GGUF models the layers to be streamed from ram to gpu on xpu (intel dGPU b580)
### Actual Behavior
all the gguf layers are loaded into vram (atleast it tries) and runs into an OOM even with smaller Q2 models (qwen edit 2511)
### Steps to Reproduce
make a run on an intel dgpu with a GGUF model that is bigger then vram
### Debug Logs
```powershell
FETCH ComfyRegistry Data: 135/162
0%| | 0/4 [00:03 0 and current_loaded_models[i].model_unload(memory_to_free):
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/workspace/ComfyUI/comfy/model_management.py", line 764, in model_unload
self.model.detach(unpatch_weights)
File "/workspace/ComfyUI/comfy/model_patcher.py", line 1246, in detach
self.unpatch_model(self.offload_device, unpatch_weights=unpatch_all)
File "/workspace/ComfyUI/comfy/model_patcher.py", line 1103, in unpatch_model
self.model.to(device_to)
File "/workspace/venv/lib/python3.12/site-packages/torch/nn/modules/module.py", line 1383, in to
return self._apply(convert)
^^^^^^^^^^^^^^^^^^^^
File "/workspace/venv/lib/python3.12/site-packages/torch/nn/modules/module.py", line 933, in _apply
module._apply(fn)
File "/workspace/venv/lib/python3.12/site-packages/torch/nn/modules/module.py", line 933, in _apply
module._apply(fn)
File "/workspace/venv/lib/python3.12/site-packages/torch/nn/modules/module.py", line 933, in _apply
module._apply(fn)
[Previous line repeated 1 more time]
File "/workspace/ComfyUI/comfy/ops.py", line 1341, in _apply
return _quantized_apply(self, fn, recurse)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/workspace/ComfyUI/comfy/ops.py", line 1019, in _quantized_apply
p = fn(param)
^^^^^^^^^
File "/workspace/venv/lib/python3.12/site-packages/torch/nn/modules/module.py", line 1369, in convert
return t.to(
^^^^^
RuntimeError: level_zero backend failed with error: 39 (UR_RESULT_ERROR_OUT_OF_DEVICE_MEMORY)
```
### Other
_No response_
Contributor guide
Research direction
Start with the model execution paths in comfy/ldm/qwen_image/model.py and weight handling in comfy/ops.py, then trace how GGUF layers are placed when using an Intel XPU. Reproduce with a GGUF model larger than available VRAM and confirm that layers stream from RAM to the GPU without triggering an out-of-memory failure.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python, pytorch
- Domain
- machine-learning
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100