Comfy-Org / Comfy-Org/ComfyUI

Flux klein KV Vram OOM issue

Open
#12,920 2 comments 4 reactions 0 assignees View on GitHub
Potential Bug
Dominant language
Python
Stars
133k
Forks
15.7k
Avg merge
1d 6h
Merged PRs (30d)
155

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

normal run

### Actual Behavior

OOM

### Steps to Reproduce

[image_flux2_klein_9b_kv_image_edit.json](https://github.com/user-attachments/files/25968685/image_flux2_klein_9b_kv_image_edit.json)

### Debug Logs

```powershell
E:\AI\ComfyUI_windows_portable>set TEMP=E:\AI\ComfyUI_windows_portable\ComfyUI_Temp

E:\AI\ComfyUI_windows_portable>set TMP=E:\AI\ComfyUI_windows_portable\ComfyUI_Temp

E:\AI\ComfyUI_windows_portable>if not exist "E:\AI\ComfyUI_windows_portable\ComfyUI_Temp" mkdir "E:\AI\ComfyUI_windows_portable\ComfyUI_Temp"

E:\AI\ComfyUI_windows_portable>.\python_embeded\python.exe -s ComfyUI\main.py --windows-standalone-build --temp-directory E:\AI\ComfyUI_windows_portable\ComfyUI_Temp
E:\AI\ComfyUI_windows_portable\python_embeded\Lib\site-packages\requests\__init__.py:113: RequestsDependencyWarning: urllib3 (2.6.3) or chardet (6.0.0.post1)/charset_normalizer (3.4.4) doesn't match a supported version!
warnings.warn(
[START] Security scan
[DONE] Security scan
## ComfyUI-Manager: installing dependencies done.
** ComfyUI startup time: 2026-03-13 08:57:35.498
** Platform: Windows
** Python version: 3.13.11 (tags/v3.13.11:6278944, Dec 5 2025, 16:26:58) [MSC v.1944 64 bit (AMD64)]
** Python executable: E:\AI\ComfyUI_windows_portable\python_embeded\python.exe
** ComfyUI Path: E:\AI\ComfyUI_windows_portable\ComfyUI
** ComfyUI Base Folder Path: E:\AI\ComfyUI_windows_portable\ComfyUI
** User directory: E:\AI\ComfyUI_windows_portable\ComfyUI\user
** ComfyUI-Manager config path: E:\AI\ComfyUI_windows_portable\ComfyUI\user\__manager\config.ini
** Log path: E:\AI\ComfyUI_windows_portable\ComfyUI\user\comfyui.log

Prestartup times for custom nodes:
0.0 seconds: E:\AI\ComfyUI_windows_portable\ComfyUI\custom_nodes\rgthree-comfy
0.0 seconds: E:\AI\ComfyUI_windows_portable\ComfyUI\custom_nodes\ComfyUI-Easy-Use
6.2 seconds: E:\AI\ComfyUI_windows_portable\ComfyUI\custom_nodes\comfyui-manager

E:\AI\ComfyUI_windows_portable\python_embeded\Lib\site-packages\torch\cuda\__init__.py:65: FutureWarning: The pynvml package is deprecated. Please install nvidia-ml-py instead. If you did not install pynvml directly, please report this to the maintainers of the package that installed pynvml for you.
import pynvml # type: ignore[import]
Found comfy_kitchen backend cuda: {'available': True, 'disabled': False, 'unavailable_reason': None, 'capabilities': ['apply_rope', 'apply_rope1', 'dequantize_nvfp4', 'dequantize_per_tensor_fp8', 'quantize_mxfp8', 'quantize_nvfp4', 'quantize_per_tensor_fp8', 'scaled_mm_nvfp4']}
Found comfy_kitchen backend triton: {'available': False, 'disabled': True, 'unavailable_reason': "ImportError: No module named 'triton'", 'capabilities': []}
Found comfy_kitchen backend eager: {'available': True, 'disabled': False, 'unavailable_reason': None, 'capabilities': ['apply_rope', 'apply_rope1', 'dequantize_mxfp8', 'dequantize_nvfp4', 'dequantize_per_tensor_fp8', 'quantize_mxfp8', 'quantize_nvfp4', 'quantize_per_tensor_fp8', 'scaled_mm_mxfp8', 'scaled_mm_nvfp4']}
Checkpoint files will always be loaded safely.
Total VRAM 4096 MB, total RAM 15775 MB
pytorch version: 2.10.0+cu130
Set vram state to: NORMAL_VRAM
Device: cuda:0 NVIDIA GeForce RTX 3050 Laptop GPU : cudaMallocAsync
Using async weight offloading with 2 streams
Enabled pinned memory 7098.0
working around nvidia conv3d memory bug.
Using pytorch attention
aimdo: src-win/cuda-detour.c:77:INFO:aimdo_setup_hooks: found driver at 00007FFCFEFF0000, installing 4 hooks
aimdo: src-win/cuda-detour.c:61:DEBUG:install_hook_entrys: hooks successfully installed
aimdo: src/control.c:69:INFO:comfy-aimdo inited for GPU: NVIDIA GeForce RTX 3050 Laptop GPU (VRAM: 4095 MB)
DynamicVRAM support detected and enabled
Python version: 3.13.11 (tags/v3.13.11:6278944, Dec 5 2025, 16:26:58) [MSC v.1944 64 bit (AMD64)]
ComfyUI version: 0.17.0
comfy-aimdo version: 0.2.10
comfy-kitchen version: 0.2.8
Setting temp directory to: E:\AI\ComfyUI_windows_portable\ComfyUI_Temp\temp
ComfyUI frontend version: 1.41.18
[Prompt Server] web root: E:\AI\ComfyUI_windows_portable\python_embeded\Lib\site-packages\comfyui_frontend_package\static
Asset seeder disabled
### Loading: ComfyUI-Manager (V3.39.2)
[ComfyUI-Manager] network_mode: public
[ComfyUI-Manager] ComfyUI per-queue preview override detected (PR #11261). Manager's preview method feature is disabled. Use ComfyUI's --preview-method CLI option or 'Settings > Execution > Live preview method'.
### ComfyUI Version: v0.17.0-1-g4a8cf359f | Released on '2026-03-12'
ComfyUI-GGUF: Allowing full torch compile
### Loading: ComfyUI-Impact-Pack (V8.28.2)
[ComfyUI-Manager] default cache updated: https://raw.githubusercontent.com/ltdrdata/ComfyUI-Manager/main/alter-list.json
[ComfyUI-Manager] default cache updated: https://raw.githubusercontent.com/ltdrdata/ComfyUI-Manager/main/model-list.json
[ComfyUI-Manager] default cache updated: https://raw.githubusercontent.com/ltdrdata/ComfyUI-Manager/main/github-stats.json
[Impact Pack] Wildcard total size (0.00 MB) is within cache limit (50.00 MB). Using full cache mode.
[Impact Pack] Wildcards loading done.
[ComfyUI-Manager] default cache updated: https://raw.githubusercontent.com/ltdrdata/ComfyUI-Manager/main/custom-node-list.json
[ComfyUI-Manager] default cache updated: https://raw.githubusercontent.com/ltdrdata/ComfyUI-Manager/main/extension-node-map.json
[ComfyUI-Easy-Use] server: v1.3.7 Loaded
[ComfyUI-Easy-Use] web root: E:\AI\ComfyUI_windows_portable\ComfyUI\custom_nodes\ComfyUI-Easy-Use\web_version/v2 Loaded
FETCH ComfyRegistry Data: 5/130
[Crystools INFO] Crystools version: 1.27.4
[Crystools INFO] Platform release: 11
[Crystools INFO] JETSON: Not detected.
[Crystools INFO] CPU: AMD Ryzen 7 5800H with Radeon Graphics - Arch: AMD64 - OS: Windows 11
[Crystools INFO] pynvml (NVIDIA) initialized.
[Crystools INFO] GPU/s:
[Crystools INFO] 0) NVIDIA GeForce RTX 3050 Laptop GPU
[Crystools INFO] NVIDIA Driver: 591.74
E:\AI\ComfyUI_windows_portable\python_embeded\Lib\site-packages\timm\models\layers\__init__.py:49: FutureWarning: Importing from timm.models.layers is deprecated, please import via timm.layers
warnings.warn(f"Importing from {__name__} is deprecated, please import via timm.layers", FutureWarning)
Error loading E:\AI\ComfyUI_windows_portable\ComfyUI\custom_nodes\ComfyUI-RMBG\py\AILab_SAM3Segment.py: No module named 'triton'
Error loading E:\AI\ComfyUI_windows_portable\ComfyUI\custom_nodes\ComfyUI-RMBG\py\AILab_SAM3Segment.py: No module named 'triton'
[ComfyUI-RMBG] v3.0.0 | 42 nodes Loaded
USDU batch patches applied successfully.
USDU batch patches applied successfully.
Using pytorch attention
(RES4LYF) Init
(RES4LYF) Importing beta samplers.
(RES4LYF) Importing legacy samplers.
[LoRA-Manager] Found LoRA roots:
- E:/AI/ComfyUI_windows_portable/ComfyUI/models/loras
[LoRA-Manager] Found checkpoint roots:
- E:/AI/ComfyUI_windows_portable/ComfyUI/models/checkpoints
- E:/AI/ComfyUI_windows_portable/ComfyUI/models/diffusion_models
- E:/AI/ComfyUI_windows_portable/ComfyUI/models/unet
[LoRA-Manager] Found embedding roots:
- E:/AI/ComfyUI_windows_portable/ComfyUI/models/embeddings
[LoRA-Manager] Symlink cache loaded with 0 mappings
[LoRA-Manager] Symlink mappings restored from cache in 25.59 ms
[LoRA-Manager] Updated 'comfyui' library with current folder paths
[LoRA-Manager] Detected async ComfyUI execution, installing async metadata hooks
[LoRA-Manager] Metadata collection hooks installed for runtime values
[LoRA-Manager] ComfyUI Metadata Collector initialized
[LoRA-Manager] Example images path:
[LoRA-Manager] Added static route for locales: /locales -> E:\AI\ComfyUI_windows_portable\ComfyUI\custom_nodes\ComfyUI-Lora-Manager\locales
### Loading: ComfyUI-Inspire-Pack (V1.23)
### Loading: ComfyUI-Impact-Subpack (V1.3.5)
[Impact Pack/Subpack] Using folder_paths to determine whitelist path: E:\AI\ComfyUI_windows_portable\ComfyUI\user\default\ComfyUI-Impact-Subpack\model-whitelist.txt
[Impact Pack/Subpack] Ensured whitelist directory exists: E:\AI\ComfyUI_windows_portable\ComfyUI\user\default\ComfyUI-Impact-Subpack
[Impact Pack/Subpack] Loaded 0 model(s) from whitelist: E:\AI\ComfyUI_windows_portable\ComfyUI\user\default\ComfyUI-Impact-Subpack\model-whitelist.txt
[Impact Subpack] ultralytics_bbox: E:\AI\ComfyUI_windows_portable\ComfyUI\models\ultralytics\bbox
[Impact Subpack] ultralytics_segm: E:\AI\ComfyUI_windows_portable\ComfyUI\models\ultralytics\segm

[rgthree-comfy] Loaded 48 magnificent nodes. 🎉

[rgthree-comfy] ComfyUI's new Node 2.0 rendering may be incompatible with some rgthree-comfy nodes and features, breaking some rendering as well as losing the ability to access a node's properties (a vital part of many nodes). It also appears to run MUCH more slowly spiking CPU usage and causing jankiness and unresponsiveness, especially with large workflows. Personally I am not planning to use the new Nodes 2.0 and, unfortunately, am not able to invest the time to investigate and overhaul rgthree-comfy where needed. If you have issues when Nodes 2.0 is enabled, I'd urge you to switch it off as well and join me in hoping ComfyUI is not planning to deprecate the existing, stable canvas rendering all together.

Ib Custom Nodes: Loaded
WAS Node Suite: OpenCV Python FFMPEG support is enabled
WAS Node Suite Warning: `ffmpeg_bin_path` is not set in `E:\AI\ComfyUI_windows_portable\ComfyUI\custom_nodes\was-ns\was_suite_config.json` config file. Will attempt to use system ffmpeg binaries if available.
FETCH ComfyRegistry Data: 10/130
WAS Node Suite: Finished. Loaded 220 nodes successfully.

"You have within you right now, everything you need to deal with whatever the world can throw at you." - Brian Tracy

Import times for custom nodes:
0.0 seconds: E:\AI\ComfyUI_windows_portable\ComfyUI\custom_nodes\websocket_image_save.py
0.0 seconds: E:\AI\ComfyUI_windows_portable\ComfyUI\custom_nodes\Comfyui-Condition-Utils
0.0 seconds: E:\AI\ComfyUI_windows_portable\ComfyUI\custom_nodes\ComfyUI-Inpaint-CropAndStitch
0.0 seconds: E:\AI\ComfyUI_windows_portable\ComfyUI\custom_nodes\ComfyUI_Ib_CustomNodes
0.0 seconds: E:\AI\ComfyUI_windows_portable\ComfyUI\custom_nodes\ComfyUI-Florence2
0.0 seconds: E:\AI\ComfyUI_windows_portable\ComfyUI\custom_nodes\comfyui-image-saver
0.0 seconds: E:\AI\ComfyUI_windows_portable\ComfyUI\custom_nodes\ComfyUI_essentials
0.0 seconds: E:\AI\ComfyUI_windows_portable\ComfyUI\custom_nodes\ComfyUI_UltimateSDUpscale
0.0 seconds: E:\AI\ComfyUI_windows_portable\ComfyUI\custom_nodes\rgthree-comfy
0.0 seconds: E:\AI\ComfyUI_windows_portable\ComfyUI\custom_nodes\ComfyUI-KJNodes
0.1 seconds: E:\AI\ComfyUI_windows_portable\ComfyUI\custom_nodes\ComfyUI-GGUF
0.1 seconds: E:\AI\ComfyUI_windows_portable\ComfyUI\custom_nodes\ComfyUI-Custom-Scripts
0.1 seconds: E:\AI\ComfyUI_windows_portable\ComfyUI\custom_nodes\ComfyUI-Inspire-Pack
0.2 seconds: E:\AI\ComfyUI_windows_portable\ComfyUI\custom_nodes\comfyui-impact-subpack
0.3 seconds: E:\AI\ComfyUI_windows_portable\ComfyUI\custom_nodes\RES4LYF
0.5 seconds: E:\AI\ComfyUI_windows_portable\ComfyUI\custom_nodes\comfyui-manager
0.5 seconds: E:\AI\ComfyUI_windows_portable\ComfyUI\custom_nodes\ComfyUI-Lora-Manager
0.5 seconds: E:\AI\ComfyUI_windows_portable\ComfyUI\custom_nodes\ComfyUI-Crystools
0.6 seconds: E:\AI\ComfyUI_windows_portable\ComfyUI\custom_nodes\Nvidia_RTX_Nodes_ComfyUI
1.5 seconds: E:\AI\ComfyUI_windows_portable\ComfyUI\custom_nodes\ComfyUI-RMBG
1.6 seconds: E:\AI\ComfyUI_windows_portable\ComfyUI\custom_nodes\ComfyUI-Impact-Pack
2.4 seconds: E:\AI\ComfyUI_windows_portable\ComfyUI\custom_nodes\was-ns
5.2 seconds: E:\AI\ComfyUI_windows_portable\ComfyUI\custom_nodes\ComfyUI-Easy-Use

Context impl SQLiteImpl.
Will assume non-transactional DDL.
Starting server

To see the GUI go to: http://127.0.0.1:8188
[LoRA-Manager] Recipe cache miss: performing full directory scan
[LoRA-Manager] Recipe cache initialized in 0.19 seconds. Found 0 recipes
[LoRA-Manager] Lora cache hydrated from persisted snapshot with 19 models
[LoRA-Manager] Checkpoint cache hydrated from persisted snapshot with 7 models
[LoRA-Manager] Embedding cache hydrated from persisted snapshot with 3 models
[LoRA-Manager] FTS index validated, reusing existing index with 0 recipes
[DEPRECATION WARNING] Detected import of deprecated legacy API: /scripts/ui.js. This is likely caused by a custom node extension using outdated APIs. Please update your extensions or contact the extension author for an updated version.
[DEPRECATION WARNING] Detected import of deprecated legacy API: /extensions/core/groupNode.js. This is likely caused by a custom node extension using outdated APIs. Please update your extensions or contact the extension author for an updated version.
[DEPRECATION WARNING] Detected import of deprecated legacy API: /extensions/core/clipspace.js. This is likely caused by a custom node extension using outdated APIs. Please update your extensions or contact the extension author for an updated version.
[DEPRECATION WARNING] Detected import of deprecated legacy API: /scripts/ui/components/buttonGroup.js. This is likely caused by a custom node extension using outdated APIs. Please update your extensions or contact the extension author for an updated version.
FETCH ComfyRegistry Data: 15/130
[Inspire Pack] IPAdapterPlus is not installed.
[DEPRECATION WARNING] Detected import of deprecated legacy API: /scripts/ui/components/button.js. This is likely caused by a custom node extension using outdated APIs. Please update your extensions or contact the extension author for an updated version.
FETCH ComfyRegistry Data: 20/130
FETCH ComfyRegistry Data: 25/130
FETCH ComfyRegistry Data: 30/130
FETCH ComfyRegistry Data: 35/130
FETCH ComfyRegistry Data: 40/130
FETCH ComfyRegistry Data: 45/130
FETCH ComfyRegistry Data: 50/130
FETCH ComfyRegistry Data: 55/130
FETCH ComfyRegistry Data: 60/130
FETCH ComfyRegistry Data: 65/130
FETCH ComfyRegistry Data: 70/130
FETCH ComfyRegistry Data: 75/130
FETCH ComfyRegistry Data: 80/130
FETCH ComfyRegistry Data: 85/130
FETCH ComfyRegistry Data: 90/130
FETCH ComfyRegistry Data: 95/130
FETCH ComfyRegistry Data: 100/130
FETCH ComfyRegistry Data: 105/130
FETCH ComfyRegistry Data: 110/130
FETCH ComfyRegistry Data: 115/130
FETCH ComfyRegistry Data: 120/130
FETCH ComfyRegistry Data: 125/130
FETCH ComfyRegistry Data: 130/130
FETCH ComfyRegistry Data [DONE]
[ComfyUI-Manager] default cache updated: https://api.comfy.org/nodes
FETCH DATA from: https://raw.githubusercontent.com/ltdrdata/ComfyUI-Manager/main/custom-node-list.json [DONE]
[ComfyUI-Manager] All startup tasks have been completed.
got prompt
Using pytorch attention in VAE
Using pytorch attention in VAE
VAE load device: cuda:0, offload device: cpu, dtype: torch.bfloat16
Requested to load AutoencoderKL
Model AutoencoderKL prepared for dynamic VRAM loading. 160MB Staged. 0 patches attached.
Model AutoencoderKL prepared for dynamic VRAM loading. 160MB Staged. 0 patches attached.
Found quantization metadata version 1
Using MixedPrecisionOps for text encoder
CLIP/text encoder model load device: cuda:0, offload device: cpu, current: cpu, dtype: torch.float16
Requested to load Flux2TEModel_
Model Flux2TEModel_ prepared for dynamic VRAM loading. 6486MB Staged. 0 patches attached. Force pre-loaded 145 weights: 602 KB.
Found quantization metadata version 1
Detected mixed precision quantization
Using mixed precision operations
model weight dtype torch.bfloat16, manual cast: torch.bfloat16
model_type FLUX
Requested to load Flux2
0 models unloaded.
Model Flux2 prepared for dynamic VRAM loading. 9364MB Staged. 0 patches attached.
0%| | 0/4 [00:38...
)
^
File "E:\AI\ComfyUI_windows_portable\ComfyUI\execution.py", line 308, in _async_map_node_over_list
await process_inputs(input_dict, i)
File "E:\AI\ComfyUI_windows_portable\ComfyUI\execution.py", line 296, in process_inputs
result = f(**inputs)
File "E:\AI\ComfyUI_windows_portable\ComfyUI\comfy_api\internal\__init__.py", line 149, in wrapped_func
return method(locked_class, **inputs)
File "E:\AI\ComfyUI_windows_portable\ComfyUI\comfy_api\latest\_io.py", line 1764, in EXECUTE_NORMALIZED
to_return = cls.execute(*args, **kwargs)
File "E:\AI\ComfyUI_windows_portable\ComfyUI\comfy_extras\nodes_custom_sampler.py", line 963, in execute
samples = guider.sample(noise.generate_noise(latent), latent_image, sampler, sigmas, denoise_mask=noise_mask, callback=callback, disable_pbar=disable_pbar, seed=noise.seed)
File "E:\AI\ComfyUI_windows_portable\ComfyUI\comfy\samplers.py", line 1051, in sample
output = executor.execute(noise, latent_image, sampler, sigmas, denoise_mask, callback, disable_pbar, seed, latent_shapes=latent_shapes)
File "E:\AI\ComfyUI_windows_portable\ComfyUI\comfy\patcher_extension.py", line 112, in execute
return self.original(*args, **kwargs)
~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^
File "E:\AI\ComfyUI_windows_portable\ComfyUI\comfy\samplers.py", line 995, in outer_sample
output = self.inner_sample(noise, latent_image, device, sampler, sigmas, denoise_mask, callback, disable_pbar, seed, latent_shapes=latent_shapes)
File "E:\AI\ComfyUI_windows_portable\ComfyUI\comfy\samplers.py", line 981, in inner_sample
samples = executor.execute(self, sigmas, extra_args, callback, noise, latent_image, denoise_mask, disable_pbar)
File "E:\AI\ComfyUI_windows_portable\ComfyUI\comfy\patcher_extension.py", line 112, in execute
return self.original(*args, **kwargs)
~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^
File "E:\AI\ComfyUI_windows_portable\ComfyUI\comfy\samplers.py", line 751, in sample
samples = self.sampler_function(model_k, noise, sigmas, extra_args=extra_args, callback=k_callback, disable=disable_pbar, **self.extra_options)
File "E:\AI\ComfyUI_windows_portable\python_embeded\Lib\site-packages\torch\utils\_contextlib.py", line 124, in decorate_context
return func(*args, **kwargs)
File "E:\AI\ComfyUI_windows_portable\ComfyUI\comfy\k_diffusion\sampling.py", line 205, in sample_euler
denoised = model(x, sigma_hat * s_in, **extra_args)
File "E:\AI\ComfyUI_windows_portable\ComfyUI\comfy\samplers.py", line 400, in __call__
out = self.inner_model(x, sigma, model_options=model_options, seed=seed)
File "E:\AI\ComfyUI_windows_portable\ComfyUI\comfy\samplers.py", line 954, in __call__
return self.outer_predict_noise(*args, **kwargs)
~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^
File "E:\AI\ComfyUI_windows_portable\ComfyUI\comfy\samplers.py", line 961, in outer_predict_noise
).execute(x, timestep, model_options, seed)
~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "E:\AI\ComfyUI_windows_portable\ComfyUI\comfy\patcher_extension.py", line 112, in execute
return self.original(*args, **kwargs)
~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^
File "E:\AI\ComfyUI_windows_portable\ComfyUI\comfy\samplers.py", line 964, in predict_noise
return sampling_function(self.inner_model, x, timestep, self.conds.get("negative", None), self.conds.get("positive", None), self.cfg, model_options=model_options, seed=seed)
File "E:\AI\ComfyUI_windows_portable\ComfyUI\comfy\samplers.py", line 380, in sampling_function
out = calc_cond_batch(model, conds, x, timestep, model_options)
File "E:\AI\ComfyUI_windows_portable\ComfyUI\comfy\samplers.py", line 205, in calc_cond_batch
return _calc_cond_batch_outer(model, conds, x_in, timestep, model_options)
File "E:\AI\ComfyUI_windows_portable\ComfyUI\comfy\samplers.py", line 213, in _calc_cond_batch_outer
return executor.execute(model, conds, x_in, timestep, model_options)
~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "E:\AI\ComfyUI_windows_portable\ComfyUI\comfy\patcher_extension.py", line 112, in execute
return self.original(*args, **kwargs)
~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^
File "E:\AI\ComfyUI_windows_portable\ComfyUI\comfy\samplers.py", line 325, in _calc_cond_batch
output = model.apply_model(input_x, timestep_, **c).chunk(batch_chunks)
~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^
File "E:\AI\ComfyUI_windows_portable\ComfyUI\comfy\model_base.py", line 170, in apply_model
return comfy.patcher_extension.WrapperExecutor.new_class_executor(
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
...<2 lines>...
comfy.patcher_extension.get_all_wrappers(comfy.patcher_extension.WrappersMP.APPLY_MODEL, transformer_options)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
).execute(x, t, c_concat, c_crossattn, control, transformer_options, **kwargs)
~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "E:\AI\ComfyUI_windows_portable\ComfyUI\comfy\patcher_extension.py", line 112, in execute
return self.original(*args, **kwargs)
~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^
File "E:\AI\ComfyUI_windows_portable\ComfyUI\comfy\model_base.py", line 209, in _apply_model
model_output = self.diffusion_model(xc, t, context=context, control=control, transformer_options=transformer_options, **extra_conds)
File "E:\AI\ComfyUI_windows_portable\python_embeded\Lib\site-packages\torch\nn\modules\module.py", line 1776, in _wrapped_call_impl
return self._call_impl(*args, **kwargs)
~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^
File "E:\AI\ComfyUI_windows_portable\python_embeded\Lib\site-packages\torch\nn\modules\module.py", line 1787, in _call_impl
return forward_call(*args, **kwargs)
File "E:\AI\ComfyUI_windows_portable\ComfyUI\comfy\ldm\flux\model.py", line 345, in forward
return comfy.patcher_extension.WrapperExecutor.new_class_executor(
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
...<2 lines>...
comfy.patcher_extension.get_all_wrappers(comfy.patcher_extension.WrappersMP.DIFFUSION_MODEL, transformer_options)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
).execute(x, timestep, context, y, guidance, ref_latents, control, transformer_options, **kwargs)
~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "E:\AI\ComfyUI_windows_portable\ComfyUI\comfy\patcher_extension.py", line 112, in execute
return self.original(*args, **kwargs)
~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^
File "E:\AI\ComfyUI_windows_portable\ComfyUI\comfy\ldm\flux\model.py", line 406, in _forward
out = self.forward_orig(img, img_ids, context, txt_ids, timestep, y, guidance, control, timestep_zero_index=timestep_zero_index, transformer_options=transformer_options, attn_mask=kwargs.get("attention_mask", None))
File "E:\AI\ComfyUI_windows_portable\ComfyUI\comfy\ldm\flux\model.py", line 296, in forward_orig
img = block(img, vec=vec, pe=pe, attn_mask=attn_mask, transformer_options=transformer_options, **extra_kwargs)
File "E:\AI\ComfyUI_windows_portable\python_embeded\Lib\site-packages\torch\nn\modules\module.py", line 1776, in _wrapped_call_impl
return self._call_impl(*args, **kwargs)
~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^
File "E:\AI\ComfyUI_windows_portable\python_embeded\Lib\site-packages\torch\nn\modules\module.py", line 1787, in _call_impl
return forward_call(*args, **kwargs)
File "E:\AI\ComfyUI_windows_portable\ComfyUI\comfy\ldm\flux\layers.py", line 351, in forward
output = self.linear2(torch.cat((attn, mlp), 2))
~~~~~~~~~^^^^^^^^^^^^^^^^
torch.OutOfMemoryError: Allocation on device 0 would exceed allowed memory. (out of memory)
Currently allocated : 2.75 GiB
Requested : 205.84 MiB
Device limit : 4.00 GiB
Free (according to CUDA): 0 bytes
PyTorch limit (set by user-supplied memory fraction)
: 17179869184.00 GiB

Memory summary: |===========================================================================|
| PyTorch CUDA memory summary, device ID 0 |
|---------------------------------------------------------------------------|
| CUDA OOMs: 0 | cudaMalloc retries: 0 |
|===========================================================================|
| Metric | Cur Usage | Peak Usage | Tot Alloc | Tot Freed |
|---------------------------------------------------------------------------|
| Allocated memory | 914 MiB | 3139 MiB | 0 B | 0 B |
| from large pool | 0 MiB | 0 MiB | 0 B | 0 B |
| from small pool | 0 MiB | 0 MiB | 0 B | 0 B |
|---------------------------------------------------------------------------|
| Active memory | 914 MiB | 3139 MiB | 0 B | 0 B |
| from large pool | 0 MiB | 0 MiB | 0 B | 0 B |
| from small pool | 0 MiB | 0 MiB | 0 B | 0 B |
|---------------------------------------------------------------------------|
| Requested memory | 0 B | 0 B | 0 B | 0 B |
| from large pool | 0 B | 0 B | 0 B | 0 B |
| from small pool | 0 B | 0 B | 0 B | 0 B |
|---------------------------------------------------------------------------|
| GPU reserved memory | 1216 MiB | 4032 MiB | 0 B | 0 B |
| from large pool | 0 MiB | 0 MiB | 0 B | 0 B |
| from small pool | 0 MiB | 0 MiB | 0 B | 0 B |
|---------------------------------------------------------------------------|
| Non-releasable memory | 0 B | 0 B | 0 B | 0 B |
| from large pool | 0 B | 0 B | 0 B | 0 B |
| from small pool | 0 B | 0 B | 0 B | 0 B |
|---------------------------------------------------------------------------|
| Allocations | 0 | 0 | 0 | 0 |
| from large pool | 0 | 0 | 0 | 0 |
| from small pool | 0 | 0 | 0 | 0 |
|---------------------------------------------------------------------------|
| Active allocs | 0 | 0 | 0 | 0 |
| from large pool | 0 | 0 | 0 | 0 |
| from small pool | 0 | 0 | 0 | 0 |
|---------------------------------------------------------------------------|
| GPU reserved segments | 0 | 0 | 0 | 0 |
| from large pool | 0 | 0 | 0 | 0 |
| from small pool | 0 | 0 | 0 | 0 |
|---------------------------------------------------------------------------|
| Non-releasable allocs | 0 | 0 | 0 | 0 |
| from large pool | 0 | 0 | 0 | 0 |
| from small pool | 0 | 0 | 0 | 0 |
|---------------------------------------------------------------------------|
| Oversize allocations | 0 | 0 | 0 | 0 |
|---------------------------------------------------------------------------|
| Oversize GPU segments | 0 | 0 | 0 | 0 |
|===========================================================================|

Got an OOM, unloading all loaded models.
Prompt executed in 72.21 seconds
```

### Other

FYI: I have already tried new commit, still KV version is not working. But, Normal klein9b fp8 version works well for my low vram setup.

Contributor guide

Open the contributing guide

Research direction

Start by loading image_flux2_klein_9b_kv_image_edit.json and reproducing the OOM on the stated Windows, Python 3.13.11, PyTorch 2.10.0, and 4 GB VRAM setup. Read ComfyUI/main.py and compare a run with custom nodes disabled, as the report says the failure persists. Done means the workflow completes normally or the responsible memory path and a targeted fix are identified.

Written by the indexing model from the issue text.

Assessment

Tech stack
python, pytorch
Domain
machine-learning, performance
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.