Comfy-Org / Comfy-Org/ComfyUI

use-sage-attention BUG???

Open
#15,844 3 comments 0 reactions 0 assignees View on GitHub
Potential Bug
Dominant language
Python
Stars
133k
Forks
15.7k
Avg merge
1d 7h
Merged PRs (30d)
158

Description

### Custom Node Testing

- [ ] 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

use-sage-attention BUG???
What is the cause of this problem of mine? I'm looking forward to your reply. I'm in a hurry!!!

### Actual Behavior

use-sage-attention

### Steps to Reproduce

I used the "use-sage-attention" method.

### Debug Logs

```powershell
C:\Users\Master>set SAGEATTN=1

C:\Users\Master>cd /d D:\Master\ComfyUI_windows_portable

D:\Master\ComfyUI_windows_portable>.\python_embeded\python.exe -s ComfyUI\main.py --windows-standalone-build --listen 0.0.0.0 --use-sage-attention
[INFO] setup plugin alembic.autogenerate.schemas
[INFO] setup plugin alembic.autogenerate.tables
[INFO] setup plugin alembic.autogenerate.types
[INFO] setup plugin alembic.autogenerate.constraints
[INFO] setup plugin alembic.autogenerate.defaults
[INFO] setup plugin alembic.autogenerate.comments
[INFO] Found comfy_kitchen backend triton: {'available': True, 'disabled': True, 'unavailable_reason': None, 'capabilities': ['adaln', 'apply_rope', 'apply_rope1', 'apply_rope1_', 'apply_rope_', 'apply_rope_split_half', 'apply_rope_split_half1', 'apply_rope_split_half1_', 'apply_rope_split_half_', 'dequantize_nvfp4', 'dequantize_per_tensor_fp8', 'int8_linear', 'quantize_and_rotate_rowwise', 'quantize_int8_rowwise', 'quantize_mxfp8', 'quantize_nvfp4', 'quantize_per_tensor_fp8', 'rms_adaln', 'rms_rope', 'rms_rope1', 'rms_rope1_', 'rms_rope_', 'rms_rope_split_half', 'rms_rope_split_half1', 'rms_rope_split_half1_', 'rms_rope_split_half_']}
[INFO] Found comfy_kitchen backend eager: {'available': True, 'disabled': False, 'unavailable_reason': None, 'capabilities': ['adaln', 'apply_rope', 'apply_rope1', 'apply_rope1_', 'apply_rope_', 'apply_rope_split_half', 'apply_rope_split_half1', 'apply_rope_split_half1_', 'apply_rope_split_half_', 'convrot_w4a4_linear', 'dequantize_convrot_w4a4_weight', 'dequantize_int8_convrot_weight', 'dequantize_int8_convrot_weight_dtype', 'dequantize_int8_embedding', 'dequantize_int8_simple', 'dequantize_int8_simple_dtype', 'dequantize_mxfp8', 'dequantize_nvfp4', 'dequantize_per_tensor_fp8', 'gemv_awq_w4a16', 'int8_linear', 'prepare_int4_weight_for_int8_linear', 'quantize_and_rotate_rowwise', 'quantize_convrot_w4a4_weight', 'quantize_int8_convrot_weight', 'quantize_int8_rowwise', 'quantize_int8_tensorwise', 'quantize_mxfp8', 'quantize_nvfp4', 'quantize_per_tensor_fp8', 'quantize_svdquant_w4a4', 'rms_adaln', 'rms_rope', 'rms_rope1', 'rms_rope1_', 'rms_rope_', 'rms_rope_split_half', 'rms_rope_split_half1', 'rms_rope_split_half1_', 'rms_rope_split_half_', 'scaled_mm_mxfp8', 'scaled_mm_nvfp4', 'scaled_mm_svdquant_w4a4', 'stochastic_rounding_fp8']}
[INFO] Found comfy_kitchen backend hip: {'available': False, 'disabled': False, 'unavailable_reason': 'PyTorch ROCm/HIP runtime not available', 'capabilities': []}
[INFO] Found comfy_kitchen backend cuda: {'available': True, 'disabled': False, 'unavailable_reason': None, 'capabilities': ['adaln', 'apply_rope', 'apply_rope1', 'apply_rope1_', 'apply_rope_', 'apply_rope_split_half', 'apply_rope_split_half1', 'apply_rope_split_half1_', 'apply_rope_split_half_', 'convrot_w4a4_linear', 'dequantize_convrot_w4a4_weight', 'dequantize_int8_convrot_weight', 'dequantize_int8_convrot_weight_dtype', 'dequantize_int8_simple', 'dequantize_int8_simple_dtype', 'dequantize_nvfp4', 'dequantize_per_tensor_fp8', 'gemv_awq_w4a16', 'int8_linear', 'prepare_int4_weight_for_int8_linear', 'quantize_and_rotate_rowwise', 'quantize_convrot_w4a4_weight', 'quantize_int8_convrot_weight', 'quantize_int8_rowwise', 'quantize_int8_tensorwise', 'quantize_mxfp8', 'quantize_nvfp4', 'quantize_per_tensor_fp8', 'quantize_svdquant_w4a4', 'rms_adaln', 'rms_rope', 'rms_rope1', 'rms_rope1_', 'rms_rope_', 'rms_rope_split_half', 'rms_rope_split_half1', 'rms_rope_split_half1_', 'rms_rope_split_half_', 'scaled_mm_nvfp4', 'scaled_mm_svdquant_w4a4', 'stochastic_rounding_fp8']}
[INFO] Checkpoint files will always be loaded safely.
[INFO] Total VRAM 49139 MB, total RAM 97948 MB
[INFO] pytorch version: 2.13.0+cu130
[INFO] Set vram state to: NORMAL_VRAM
[INFO] Device: cuda:0 NVIDIA GeForce RTX 4090 : cudaMallocAsync
[INFO] Using async weight offloading with 2 streams
[INFO] Enabled pinned memory 39179.0
[INFO] Using sage attention
aimdo: src-win/cuda-detour.c:38:INFO:aimdo_setup_hooks: installing 6 hooks
aimdo: src-win/cuda-detour.c:28:DEBUG:install_hook_entries: hooks successfully installed
aimdo: src/control.c:262:INFO:comfy-aimdo NVML pressure enabled
aimdo: src-win/shmem-detect.c:80:INFO:comfy-aimdo WDDM adapter match: NVIDIA GeForce RTX 4090 runtime_luid=00000000:0001784b dxgi_luid=00000000:0001784b
aimdo: src/control.c:277:INFO:comfy-aimdo inited for GPU: NVIDIA GeForce RTX 4090 (VRAM: 49139 MB)
[INFO] DynamicVRAM support detected and enabled
[INFO] Python version: 3.13.14 (tags/v3.13.14:fd17997, Jun 10 2026, 13:03:48) [MSC v.1944 64 bit (AMD64)]
[INFO] ComfyUI version: 0.30.0
[INFO] comfy-aimdo version: 0.4.11
[INFO] comfy-kitchen version: 0.2.26
[INFO] comfyui-frontend-package version: 1.47.11
[INFO] comfyui-workflow-templates version: 0.11.27
[INFO] comfyui-embedded-docs version: 0.5.9
[INFO] comfy-kitchen version: 0.2.26
[INFO] comfy-aimdo version: 0.4.11
[INFO] [Prompt Server] web root: D:\Master\ComfyUI_windows_portable\python_embeded\Lib\site-packages\comfyui_frontend_package\static
[INFO] Asset seeder disabled
[INFO] No OpenGL_accelerate module loaded: No module named 'OpenGL_accelerate'
[INFO]
Import times for custom nodes:
[INFO] 0.0 seconds: D:\Master\ComfyUI_windows_portable\ComfyUI\custom_nodes\websocket_image_save.py
[INFO]
[INFO] Context impl SQLiteImpl.
[INFO] Will assume non-transactional DDL.
[INFO] Using RAM pressure cache.
[INFO] Starting server

[INFO] To see the GUI go to: http://0.0.0.0:8188
[INFO] got prompt
[ERROR] Error handling request from 127.0.0.1
Traceback (most recent call last):
File "D:\Master\ComfyUI_windows_portable\python_embeded\Lib\site-packages\aiohttp\web_protocol.py", line 575, in _handle_request
resp = await request_handler(request)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "D:\Master\ComfyUI_windows_portable\python_embeded\Lib\site-packages\aiohttp\web_app.py", line 559, in _handle
return await handler(request)
^^^^^^^^^^^^^^^^^^^^^^
File "D:\Master\ComfyUI_windows_portable\python_embeded\Lib\site-packages\aiohttp\web_middlewares.py", line 117, in impl
return await handler(request)
^^^^^^^^^^^^^^^^^^^^^^
File "D:\Master\ComfyUI_windows_portable\ComfyUI\middleware\cache_middleware.py", line 27, in cache_control
response: web.Response = await handler(request)
^^^^^^^^^^^^^^^^^^^^^^
File "D:\Master\ComfyUI_windows_portable\ComfyUI\server.py", line 98, in deprecation_warning
response: web.Response = await handler(request)
^^^^^^^^^^^^^^^^^^^^^^
File "D:\Master\ComfyUI_windows_portable\ComfyUI\server.py", line 193, in origin_only_middleware
response = await handler(request)
^^^^^^^^^^^^^^^^^^^^^^
File "D:\Master\ComfyUI_windows_portable\ComfyUI\server.py", line 466, in upload_image
post = await request.post()
^^^^^^^^^^^^^^^^^^^^
File "D:\Master\ComfyUI_windows_portable\python_embeded\Lib\site-packages\aiohttp\web_request.py", line 774, in post
while chunk := await field.read_chunk(size=DEFAULT_CHUNK_SIZE):
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "D:\Master\ComfyUI_windows_portable\python_embeded\Lib\site-packages\aiohttp\multipart.py", line 361, in read_chunk
chunk = await self._read_chunk_from_stream(size)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "D:\Master\ComfyUI_windows_portable\python_embeded\Lib\site-packages\aiohttp\multipart.py", line 420, in _read_chunk_from_stream
chunk += await self._content.read(size)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "D:\Master\ComfyUI_windows_portable\python_embeded\Lib\site-packages\aiohttp\streams.py", line 413, in read
raise self._exception
ConnectionResetError: Connection lost
[ERROR] Error handling request from 127.0.0.1
Traceback (most recent call last):
File "D:\Master\ComfyUI_windows_portable\python_embeded\Lib\site-packages\aiohttp\web_protocol.py", line 575, in _handle_request
resp = await request_handler(request)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "D:\Master\ComfyUI_windows_portable\python_embeded\Lib\site-packages\aiohttp\web_app.py", line 559, in _handle
return await handler(request)
^^^^^^^^^^^^^^^^^^^^^^
File "D:\Master\ComfyUI_windows_portable\python_embeded\Lib\site-packages\aiohttp\web_middlewares.py", line 117, in impl
return await handler(request)
^^^^^^^^^^^^^^^^^^^^^^
File "D:\Master\ComfyUI_windows_portable\ComfyUI\middleware\cache_middleware.py", line 27, in cache_control
response: web.Response = await handler(request)
^^^^^^^^^^^^^^^^^^^^^^
File "D:\Master\ComfyUI_windows_portable\ComfyUI\server.py", line 98, in deprecation_warning
response: web.Response = await handler(request)
^^^^^^^^^^^^^^^^^^^^^^
File "D:\Master\ComfyUI_windows_portable\ComfyUI\server.py", line 193, in origin_only_middleware
response = await handler(request)
^^^^^^^^^^^^^^^^^^^^^^
File "D:\Master\ComfyUI_windows_portable\ComfyUI\server.py", line 466, in upload_image
post = await request.post()
^^^^^^^^^^^^^^^^^^^^
File "D:\Master\ComfyUI_windows_portable\python_embeded\Lib\site-packages\aiohttp\web_request.py", line 774, in post
while chunk := await field.read_chunk(size=DEFAULT_CHUNK_SIZE):
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "D:\Master\ComfyUI_windows_portable\python_embeded\Lib\site-packages\aiohttp\multipart.py", line 361, in read_chunk
chunk = await self._read_chunk_from_stream(size)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "D:\Master\ComfyUI_windows_portable\python_embeded\Lib\site-packages\aiohttp\multipart.py", line 420, in _read_chunk_from_stream
chunk += await self._content.read(size)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "D:\Master\ComfyUI_windows_portable\python_embeded\Lib\site-packages\aiohttp\streams.py", line 413, in read
raise self._exception
ConnectionResetError: Connection lost
[INFO] VAE load device: cuda:0, offload device: cpu, dtype: torch.float32
[INFO] got prompt
[INFO] VAE load device: cuda:0, offload device: cpu, dtype: torch.float16
[INFO] Found quantization metadata version 1
[INFO] Using MixedPrecisionOps for text encoder
[INFO] CLIP/text encoder model load device: cuda:0, offload device: cpu, current: cpu, dtype: torch.float16
[INFO] Requested to load MiniMaxH3VideoVAE
[INFO] Model MiniMaxH3VideoVAE prepared for dynamic VRAM loading. 4965MB Staged. 0 patches attached. Force pre-loaded 128 weights: 348 KB.
[INFO] Model MiniMaxH3VideoVAE prepared for dynamic VRAM loading. 4965MB Staged. 0 patches attached. Force pre-loaded 128 weights: 348 KB.
[INFO] Requested to load MiniMaxH3TEModel_
[INFO] Model MiniMaxH3TEModel_ prepared for dynamic VRAM loading. 14956MB Staged. 0 patches attached. Force pre-loaded 410 weights: 4572 KB.
[INFO] Found quantization metadata version 1
[INFO] Detected mixed precision quantization
[INFO] Using mixed precision operations
[INFO] Native ops: int8_tensorwise, convrot_w4a4, float8_e4m3fn, float8_e5m2 , emulated ops: nvfp4, mxfp8
[INFO] model weight dtype torch.bfloat16, manual cast: torch.bfloat16
[INFO] model_type FLOW
[INFO] Requested to load MiniMaxH3
[INFO] Model MiniMaxH3 prepared for dynamic VRAM loading. 19995MB Staged. 0 patches attached. Force pre-loaded 210 weights: 1175 KB.
100%|██████████████████████████████████████████████████████████████████████████████████| 20/20 [01:05<00:00, 3.27s/it]
[INFO] Requested to load MiniMaxH3AudioVAE
[INFO] Model MiniMaxH3AudioVAE prepared for dynamic VRAM loading. 576MB Staged. 0 patches attached. Force pre-loaded 401 weights: 539 KB.
[INFO] Model MiniMaxH3VideoVAE prepared for dynamic VRAM loading. 4965MB Staged. 0 patches attached. Force pre-loaded 128 weights: 348 KB.
[INFO] Prompt executed in 106.91 seconds
[INFO] Model MiniMaxH3 prepared for dynamic VRAM loading. 19995MB Staged. 0 patches attached. Force pre-loaded 210 weights: 1175 KB.
100%|██████████████████████████████████████████████████████████████████████████████████| 20/20 [01:06<00:00, 3.30s/it]
[INFO] Model MiniMaxH3AudioVAE prepared for dynamic VRAM loading. 576MB Staged. 0 patches attached. Force pre-loaded 401 weights: 539 KB.
[INFO] Model MiniMaxH3VideoVAE prepared for dynamic VRAM loading. 4965MB Staged. 0 patches attached. Force pre-loaded 128 weights: 348 KB.
[INFO] Prompt executed in 76.53 seconds
[INFO] got prompt
[INFO] Model MiniMaxH3VideoVAE prepared for dynamic VRAM loading. 4965MB Staged. 0 patches attached. Force pre-loaded 128 weights: 348 KB.
[INFO] Model MiniMaxH3VideoVAE prepared for dynamic VRAM loading. 4965MB Staged. 0 patches attached. Force pre-loaded 128 weights: 348 KB.
[INFO] Model MiniMaxH3VideoVAE prepared for dynamic VRAM loading. 4965MB Staged. 0 patches attached. Force pre-loaded 128 weights: 348 KB.
[INFO] Model MiniMaxH3VideoVAE prepared for dynamic VRAM loading. 4965MB Staged. 0 patches attached. Force pre-loaded 128 weights: 348 KB.
[INFO] Model MiniMaxH3VideoVAE prepared for dynamic VRAM loading. 4965MB Staged. 0 patches attached. Force pre-loaded 128 weights: 348 KB.
[INFO] Model MiniMaxH3VideoVAE prepared for dynamic VRAM loading. 4965MB Staged. 0 patches attached. Force pre-loaded 128 weights: 348 KB.
[INFO] Model MiniMaxH3VideoVAE prepared for dynamic VRAM loading. 4965MB Staged. 0 patches attached. Force pre-loaded 128 weights: 348 KB.
[INFO] Model MiniMaxH3VideoVAE prepared for dynamic VRAM loading. 4965MB Staged. 0 patches attached. Force pre-loaded 128 weights: 348 KB.
[INFO] Model MiniMaxH3VideoVAE prepared for dynamic VRAM loading. 4965MB Staged. 0 patches attached. Force pre-loaded 128 weights: 348 KB.
[INFO] Model MiniMaxH3VideoVAE prepared for dynamic VRAM loading. 4965MB Staged. 0 patches attached. Force pre-loaded 128 weights: 348 KB.
[INFO] Model MiniMaxH3AudioVAE prepared for dynamic VRAM loading. 576MB Staged. 0 patches attached. Force pre-loaded 401 weights: 539 KB.
[INFO] Model MiniMaxH3VideoVAE prepared for dynamic VRAM loading. 4965MB Staged. 0 patches attached. Force pre-loaded 128 weights: 348 KB.
[INFO] Model MiniMaxH3AudioVAE prepared for dynamic VRAM loading. 576MB Staged. 0 patches attached. Force pre-loaded 401 weights: 539 KB.
[INFO] Model MiniMaxH3VideoVAE prepared for dynamic VRAM loading. 4965MB Staged. 0 patches attached. Force pre-loaded 128 weights: 348 KB.
[INFO] Model MiniMaxH3AudioVAE prepared for dynamic VRAM loading. 576MB Staged. 0 patches attached. Force pre-loaded 401 weights: 539 KB.
[INFO] Model MiniMaxH3AudioVAE prepared for dynamic VRAM loading. 576MB Staged. 0 patches attached. Force pre-loaded 401 weights: 539 KB.
[INFO] Model MiniMaxH3AudioVAE prepared for dynamic VRAM loading. 576MB Staged. 0 patches attached. Force pre-loaded 401 weights: 539 KB.
[INFO] Model MiniMaxH3AudioVAE prepared for dynamic VRAM loading. 576MB Staged. 0 patches attached. Force pre-loaded 401 weights: 539 KB.
[INFO] Model MiniMaxH3TEModel_ prepared for dynamic VRAM loading. 14956MB Staged. 0 patches attached. Force pre-loaded 410 weights: 4572 KB.
[INFO] 0 models unloaded.
[INFO] Model MiniMaxH3 prepared for dynamic VRAM loading. 19995MB Staged. 0 patches attached. Force pre-loaded 210 weights: 1175 KB.
0%| | 0/20 [00:00set SAGEATTN=1

D:\Master\ComfyUI_windows_portable>cd /d D:\Master\ComfyUI_windows_portable

D:\Master\ComfyUI_windows_portable>.\python_embeded\python.exe -s ComfyUI\main.py --windows-standalone-build --listen 0.0.0.0 --use-sage-attentionset SAGEATTN=1
usage: main.py [-h] [--listen [IP]] [--port PORT] [--tls-keyfile TLS_KEYFILE] [--tls-certfile TLS_CERTFILE] [--enable-cors-header [ORIGIN]]
[--max-upload-size MAX_UPLOAD_SIZE] [--base-directory BASE_DIRECTORY] [--extra-model-paths-config PATH [PATH ...]]
[--output-directory OUTPUT_DIRECTORY] [--temp-directory TEMP_DIRECTORY] [--input-directory INPUT_DIRECTORY] [--auto-launch]
[--disable-auto-launch] [--cuda-device DEVICE_ID] [--default-device DEFAULT_DEVICE_ID] [--cuda-malloc | --disable-cuda-malloc]
[--force-fp32 | --force-fp16] [--fp32-unet | --fp64-unet | --bf16-unet | --fp16-unet | --fp8_e4m3fn-unet | --fp8_e5m2-unet |
--fp8_e8m0fnu-unet] [--fp16-vae | --fp32-vae | --bf16-vae] [--cpu-vae] [--fp8_e4m3fn-text-enc | --fp8_e5m2-text-enc |
--fp16-text-enc | --fp32-text-enc | --bf16-text-enc] [--fp16-intermediates] [--force-channels-last] [--directml [DIRECTML_DEVICE]]
[--oneapi-device-selector SELECTOR_STRING] [--supports-fp8-compute] [--enable-triton-backend] [--disable-triton-backend]
[--preview-method [none,auto,latent2rgb,taesd]] [--preview-size PREVIEW_SIZE] [--cache-ram [GB ...] | --cache-classic |
--cache-lru CACHE_LRU | --cache-none | --high-ram] [--use-split-cross-attention | --use-quad-cross-attention |
--use-pytorch-cross-attention | --use-sage-attention | --use-flash-attention] [--disable-xformers] [--force-upcast-attention |
--dont-upcast-attention] [--enable-manager] [--disable-manager-ui | --enable-manager-legacy-ui] [--gpu-only | --highvram |
--lowvram | --novram | --cpu] [--reserve-vram RESERVE_VRAM] [--vram-headroom VRAM_HEADROOM] [--disable-nvml-pressure]
[--async-offload [NUM_STREAMS]] [--disable-async-offload] [--disable-dynamic-vram] [--enable-dynamic-vram] [--fast-disk]
[--force-non-blocking] [--default-hashing-function {md5,sha1,sha256,sha512}] [--disable-smart-memory] [--deterministic]
[--fast [FAST ...]] [--debug-hang] [--disable-pinned-memory] [--mmap-torch-files] [--disable-mmap] [--dont-print-server]
[--quick-test-for-ci] [--windows-standalone-build] [--disable-metadata] [--disable-all-custom-nodes]
[--whitelist-custom-nodes WHITELIST_CUSTOM_NODES [WHITELIST_CUSTOM_NODES ...]] [--disable-api-nodes] [--multi-user]
[--verbose [LEVEL FILE ...]] [--log-stdout] [--front-end-version FRONT_END_VERSION] [--front-end-root FRONT_END_ROOT]
[--user-directory USER_DIRECTORY] [--models-directory MODELS_DIRECTORY] [--enable-compress-response-body]
[--comfy-api-base COMFY_API_BASE] [--database-url DATABASE_URL] [--enable-assets] [--enable-asset-hashing]
[--feature-flag KEY[=VALUE]] [--list-feature-flags]
main.py: error: unrecognized arguments: --use-sage-attentionset SAGEATTN=1

D:\Master\ComfyUI_windows_portable>cd /d D:\Master\ComfyUI_windows_portable

D:\Master\ComfyUI_windows_portable>.\python_embeded\python.exe -s ComfyUI\main.py --windows-standalone-build --listen 0.0.0.0 --use-sage-attention
```

### Other

_No response_

Contributor guide

Open the contributing guide

Research direction

Start with the --use-sage-attention startup path and the upload_image handler in ComfyUI/server.py, then trace the aiohttp ConnectionResetError shown in the logs. Reproduce the reported workflow with and without sage attention and establish whether the upload failure is related; done means the cause and a minimal reproducible case are identified.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.