Commit Graph

604 Commits

Author SHA1 Message Date
Scott 4e2c2e3afb
Merge d6762aa7da into 6665515349 2026-07-19 19:40:23 -07:00
comfyanonymous c9602625e4
Implement regular and timestep zero reference images to krea 2 for ostris and identity edit ref loras. (#14843) 2026-07-18 17:12:18 -07:00
comfyanonymous 0f42ba5146
Support anima lllite control models. (#14954)
Put them in the models/model_patches folder. Use the new AnimaLLLiteApply node.
2026-07-17 07:36:21 -07:00
comfyanonymous 71b73e3b2b
Speed up anima a bit. (#14953) 2026-07-16 19:44:02 -07:00
彼彼 03978e1e81
[feat]Add JoyImageEdit native model support (#14428) 2026-07-15 23:48:28 -04:00
comfyanonymous c35a622acd
Fix hidream o1 regression. (#14923) 2026-07-13 12:52:28 -07:00
comfyanonymous 917faef771
Support PID 1.5 models. (#14894) 2026-07-12 09:43:30 -07:00
comfyanonymous 69ea58697b
Try to fix flash attention related issue on AMD. (#14880) 2026-07-11 17:16:40 -07:00
comfyanonymous 92ddf07ba1
Try to fix some issues with the seedvr VAE. (#14877) 2026-07-10 19:54:28 -04:00
John Pollock 8e2e54e2b8
Add SeedVR2 support (CORE-6) (#14424) 2026-07-10 15:07:42 +08:00
Scott Yewell 55760cdeb5 attention_pytorch: skip the chunk buffer/copy when steps==1
Addresses CodeRabbit feedback on #14838: the chunking loop always
allocated a temporary output buffer and copied SDPA's result into it,
even in the common case (any non-MPS device, or MPS below the size
threshold) where steps==1 and the loop only ever runs once. Adds a
fast path that calls scaled_dot_product_attention directly and
reshapes its result, matching the original pre-fix code for that case
-- no extra allocation or copy. The chunked path (steps>1) is
unchanged.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HAMqHgFBD6e9wjU8k8U6uW
2026-07-08 16:31:12 -04:00
Scott Yewell 7b7d48faa2 Remove diagnostic logging scaffolding from the MPS attention fix
Keep the fix itself (size-based chunking/capping) but drop the
_diag_log_attn_size helper, the debug-level [MPS-ATTN-FIX:...]
messages, and the now-unused tag parameters that only existed to
support that logging -- a minimal correctness fix without added
observability scaffolding.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HAMqHgFBD6e9wjU8k8U6uW
2026-07-08 16:23:23 -04:00
Scott Yewell 7be129913f Fix MPS attention corruption for large sequences (Wan2.2 long-video)
MPS uses 32-bit indexing internally for many ops; a single attention
matrix (b*heads*seq_q*seq_k) at or above ~2^31 elements silently
corrupts output instead of raising, regardless of free unified memory.
A 61-frame/832x640 Wan2.2 case measured 7.68B elements, 3.6x over the
limit.

Fixes all four MPS-reachable attention implementations in
comfy/ldm/modules/attention.py, not just the ones a given launch
config happens to select:

- model_management.py: add bf16 to FORCE_UPCAST_ATTENTION_DTYPE
  (was fp16-only).
- attention_split: extend fp32 upcast to the second (weights x V)
  matmul, not just Q.Kt; add size-based diagnostic logging
  (_diag_log_attn_size); force chunking via a new shared
  _mps_forced_attn_chunk_steps() helper once the attention matrix
  exceeds 2^30 elements, independent of the existing memory-pressure
  based steps calculation (which never triggers on a 512GB unified
  memory machine); fix a slice_size divisibility bug that silently
  fell back to computing the whole unchunked sequence.
- attention_pytorch: port the same MPS chunking guard to the native
  SDPA path (previously unguarded and unsafe for large sequences on
  MPS), chunking over seq_q with a preallocated output buffer; zero
  behavior change when chunking doesn't engage. Also add
  attn_precision handling (get_attn_precision + float32 upcast of
  q/k/v/mask), which this path previously ignored entirely.
- attention_basic: reached via optimized_attention_for_device's
  small_input=True path whenever pytorch attention isn't enabled --
  a live path on MPS for text/image encoder attention (CLIP, T5,
  Llama, Gemma, Qwen-VL, DINO, BiRefNet, RT-DETR, etc). Had zero
  chunking of any kind; introduces a chunking loop using the same
  shared helper, preserving both bool-mask (masked_fill_) and
  float-mask (additive) handling.
- attention_sub_quad: the actual default MPS attention path (selected
  whenever no --use-*-attention flag is passed at all). Its
  free-memory-based query_chunk_size/kv_chunk_size selection has the
  same class of gap attention_split had -- on a 512GB unified-memory
  machine it always picks the largest candidate and disables
  kv-chunking entirely. Adds a new _mps_cap_subquad_chunk_sizes()
  helper that caps both values against the same MPS ceiling, entirely
  in the caller so the third-party MIT-licensed
  sub_quadratic_attention.py delegate stays untouched.
- Quiet the MPS-ATTN-FIX log to debug level (fires on every call once
  a guard engages, not deduplicated like the diagnostic logging).

Verified: standalone numerical tests confirm chunked/capped output
matches unchunked baseline (fp16-rounding-level max abs diff) for all
four functions, across no-mask/float-mask/bool-mask and fp32-upcast
variants, including the attention_sub_quad boundary case that forces
the delegate's real kv-chunked branch instead of its fast path. Shape
parity confirmed against the real 61-frame/832x640 repro case: all
four functions independently compute consistent forced chunk sizes
for the identical b*heads=40, seq=13860 shape.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HAMqHgFBD6e9wjU8k8U6uW
2026-07-08 16:23:23 -04:00
comfyanonymous b481bc15af
Support gqa on all attention backends, drop support for pytorch 2.4 (#14772) 2026-07-07 22:57:52 -04:00
Jukka Seppänen 2a61015582
feat: Support Krea2 (#14589) 2026-06-22 14:35:00 -07:00
comfyanonymous e00b55631a
Small anima optimization. (#14557) 2026-06-20 08:05:28 +08:00
Barish Ozbay cd77c551d6
feat: Context Windows sampling with LTX2 models and IC-LoRa guides (CORE-3) (#13325) 2026-06-20 07:47:31 +08:00
Jukka Seppänen e25c391888
feat: Support Boogu-Image (CORE-308) (#14523) 2026-06-17 14:22:36 -07:00
Jukka Seppänen a590d60bb1
feat: SCAIL-2 multireference (CORE-310) (#14509)
* SCAIl-2: support multiref
2026-06-17 16:21:23 +03:00
comfyanonymous 7277d99d3a
Use comfy kitchen apply rope in omnigen2 model. (#14442) 2026-06-13 09:38:39 +08:00
comfyanonymous 02656ea0bb
Fix potential dtype issue with ideogram 4. (#14436) 2026-06-12 07:51:12 -07:00
Talmaj 5ece24e73c
Depth anything 3 (Core-135) (#13853)
Co-authored-by: Alexis Rolland <alexisrolland@hotmail.com>
2026-06-10 09:28:24 +08:00
Jukka Seppänen f8e51b674c
feat: Add Bernini-R model support (Wan video) (CORE-279) (#14216) 2026-06-10 07:47:34 +08:00
Jukka Seppänen 184009c2f6
feat: Add model support for SCAIL-2 (#14373)
* initial SCAIL2 support
2026-06-09 18:24:09 +03:00
Alexis Rolland f89999289a
fix: Add back apply_rotary_emb for Qwen Image (#14364) 2026-06-09 11:55:49 +08:00
comfyanonymous 00b633f368
Revert "Add SeedVR2 support (CORE-6) (#14110)" (#14359)
This reverts commit 7863cf0e53.
2026-06-08 18:00:20 -04:00
John Pollock 7863cf0e53
Add SeedVR2 support (CORE-6) (#14110) 2026-06-08 18:15:05 +08:00
comfyanonymous 514bb8ba21
Fix ideogram if model dtype gets set to fp8. (#14291) 2026-06-04 19:20:22 -07:00
Jukka Seppänen 24f9a020ce
Support Ideogram4 (#14259) 2026-06-03 08:41:44 -07:00
comfyanonymous d4c7ebff9c
Remove old useless no comfy kitchen fallback. (#14245)
* Remove old fallback used when no comfy kitchen.

* Remove unused logging import
2026-06-02 17:52:41 -07:00
person4268 c96fcddb81
Radiance: support variant with nonzero txt_ids (#14206) 2026-06-01 22:07:48 -07:00
Jukka Seppänen 462c27fdb2
feat: Add TripoSplat support (#14210) 2026-06-01 07:01:50 -07:00
comfyanonymous 81aa5a38b2
Speed up ernie model by a bit on nvidia and use higher quality rope. (#14192) 2026-05-30 17:53:37 -07:00
comfyanonymous 0b04660ba3
Speed up anima a bit on nvidia. (#14181) 2026-05-29 22:47:10 -07:00
comfyanonymous 6e1ef2311b
Remove useless code. (#14178) 2026-05-29 16:26:46 -07:00
comfyanonymous 85a403d1ea
Disable sage attention in stable audio dit and VAE. (#14148) 2026-05-27 20:35:03 -04:00
Jukka Seppänen 987a937658
Support context window for PiD and fix lq_latent rounding (#14136) 2026-05-27 12:08:06 -07:00
Jukka Seppänen 28f4ef277c
feat: Support NVIDIA PixelDiT and PiD (CORE-201) (#14103) 2026-05-26 17:50:14 -07:00
Jukka Seppänen f9f54cae42
Lens: some cleanup (#14112)
* Lens: remove redundant memory optimization
2026-05-26 10:32:53 +03:00
Jukka Seppänen 41812fa0ac
feat: Microsoft Lens support (CORE-248) (#14077) 2026-05-25 23:01:51 -07:00
Ivan Zorin 57414dadfe
fix: cross-attention AdaLN scale, shift, sigma parameters calculation (#14097) 2026-05-25 20:07:09 -07:00
comfyanonymous da49b7d0b6
Remove useless annotations imports. (#14105) 2026-05-25 19:23:29 -07:00
Jedrzej Kosinski 0a2dd86e78
MultiGPU Work Units For Accelerated Sampling (CORE-184) (#7063) 2026-05-25 18:26:40 -07:00
comfyanonymous 08d809d128
Fix --use-flash-attention ignored when xformers installed. (#14083) 2026-05-23 17:44:28 -07:00
comfyanonymous f9c84c94b4
Support Stable Audio 3 model. (#14010) 2026-05-20 11:34:22 -04:00
Cezarijus Kivylius 78b5dec6b6
fix: Hunyuan3D 2.1 batch size crashes in attention and forward pass (#13699) 2026-05-20 19:58:49 +08:00
Jukka Seppänen 33ce449c8b
Reduce LTX2.3 peak VRAM when guide_mask is in use (CORE-166) (#13735)
- Reduce peak VRAM by handling self_attn_mask more efficiently
- Fallback to SDPA when self_attention_mask is used
2026-05-16 00:02:27 +03:00
Jukka Seppänen 77e2ed5e01
feat: Support MoGe (CORE-168) (#13878) 2026-05-15 10:34:56 +08:00
Jukka Seppänen 8e53f001a4
feat: Support HiDream-O1-Image (CORE-187) (#13817)
* Initial HiDream01-image support

* Cleanup nodes

* Cleaner handling of empty placeholder models

* Remove snap_to_predefined, prefer tooltip for the trained resolutions

* Add model and block wrappers

* Fix shift tooltip

* Add node to work around the patch tile issue

Experimental, runs multiple passes with the patch grid offset and blends with various different methods.

* Qwen35 vision rotary_pos_emb cast fix

* Fix embedding layout type

* Some small optimizations

* Cleanup, don't need this fallback

* Prefix KV cache, cleanup

Bit of speed, reduce redundant code

* Get rid of redundant custom sampler, refactor noise scaling

Our existing lcm sampler is mathematically same, just added the missing options to it instead and a node to control them. Refactored the noise scaling and fix it for the stochastic samplers, add a generic node to control the initial noise scale.

* Update nodes_hidream_o1.py

* Fix some cache validation cases

* Keep existing sampling params

* Remove redundant video vision path

* Replace some numpy ops with torch

* Fx RoPE index for batch size > 1

* Prefer torch preprocessing

* Rename block_type to be compatible with existing patch nodes

* Fixes and tweaks
2026-05-11 20:35:53 -07:00
Jukka Seppänen 3200f28e3a
Support Wan-Dancer (#13813)
* initial WanDancer support

* nodes_wandancer: Add list form of chunker.

Create an alternate list form of the node so the chunk gens can be
trivially looped by the comfy executor.

* Closer match to original soxr resampling

* Remove librosa node

* Cleanup

---------

Co-authored-by: Rattus <rattus128@gmail.com>
2026-05-09 14:02:56 -07:00