Flux2: torch.OutOfMemoryError: Allocation on device
- 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
It's supposed to offload to ram anything that doesn't fit the vram and create the image, even if at lower speeds
### Actual Behavior
It produces an OOM the moment is starts with the first step. I'm using the suggested workflow in the image here https://comfyanonymous.github.io/ComfyUI_examples/flux2/flux2_example.png with no other browser tab open or anything besides the operating system running in the background
### Steps to Reproduce
load the workflow from the suggested image in the above text, hit run
### Debug Logs
```powershell
((venvk) ) juan@Kubuntu:/mnt/shared/ComfyUI$ python3 /mnt/shared/ComfyUI/main.py --disable-all-custom-nodes
Checkpoint files will always be loaded safely.
Total VRAM 24121 MB, total RAM 61933 MB
pytorch version: 2.8.0+cu128
Set vram state to: NORMAL_VRAM
Device: cuda:0 NVIDIA GeForce RTX 3090 : cudaMallocAsync
Enabled pinned memory 58836.0
Using pytorch attention
Python version: 3.12.12 (main, Nov 2 2025, 06:53:34) [GCC 15.2.0]
ComfyUI version: 0.3.73
ComfyUI frontend version: 1.30.6
[Prompt Server] web root: /mnt/shared/ComfyUI/venvk/lib/python3.12/site-packages/comfyui_frontend_package/static
Total VRAM 24121 MB, total RAM 61933 MB
pytorch version: 2.8.0+cu128
Set vram state to: NORMAL_VRAM
Device: cuda:0 NVIDIA GeForce RTX 3090 : cudaMallocAsync
Enabled pinned memory 58836.0
Skipping loading of custom nodes
Context impl SQLiteImpl.
Will assume non-transactional DDL.
No target revision found.
Starting server
To see the GUI go to: http://127.0.0.1:8188
got prompt
WARNING: [Errno 2] No such file or directory: '/mnt/shared/ComfyUI/input/fennec_girl_sing.png'
WARNING: [Errno 2] No such file or directory: '/mnt/shared/ComfyUI/input/sunset.png'
Using pytorch attention in VAE
Using pytorch attention in VAE
VAE load device: cuda:0, offload device: cpu, dtype: torch.bfloat16
Using MixedPrecisionOps for text encoder: 210 quantized layers
CLIP/text encoder model load device: cuda:0, offload device: cpu, current: cpu, dtype: torch.float16
Requested to load Flux2TEModel_
loaded completely; 21831.42 MB usable, 17180.59 MB loaded, full load: True
Found quantization metadata (version 1.0)
Detected mixed precision quantization: 128 layers quantized
Using mixed precision operations: 128 quantized layers
model weight dtype torch.float8_e4m3fn, manual cast: torch.bfloat16
model_type FLUX
Requested to load Flux2
loaded partially; 20309.32 MB usable, 20308.52 MB loaded, 13504.50 MB offloaded, lowvram patches: 0
0%| | 0/20 [00:01
Contributor guide
Assessment
This issue has not been assessed yet.