Commit Graph
175 Commits
Author SHA1 Message Date
Jedrzej Kosinski 0a0c10b25b Migrate all nodes to the V3 API 2026-07-17 19:06:02 -07:00
Jedrzej Kosinski 84cbeab2e6 Remove obsolete frontend extensions 2026-07-17 16:11:14 -07:00
Jedrzej KosinskiandAmp f900f14b0b Support Anima LLLite v2 models
Amp-Thread-ID: https://ampcode.com/threads/T-019f7088-85bf-7703-87c3-f9c0ca5d711d
Co-authored-by: Amp <amp@ampcode.com>
2026-07-17 15:44:56 -07:00
Jedrzej KosinskiandAmp 9538b054cd Cast SparseCtrl/SVD control models to unet dtype after loading
Setting controlnet_config["dtype"] alone is not enough: comfy's lazy/zero-copy
state_dict loading (Windows + aimdo path in disable_weight_init) assigns the
on-disk fp32 tensors directly as parameters and ignores the configured dtype.
With the disable_weight_init ops (no runtime weight casting), the control model
then runs fp32 weights against fp16 activations, raising "mat1 and mat2 must have
the same dtype, but got Half and Float" at the first time_embed Linear.

Explicitly cast the control model to unet_dtype after load_state_dict (mirroring
the motion model load and AnimateDiff-Evolved #573) so the weights always match
the activation dtype at runtime.

Verified end-to-end with v3_sd15_sparsectrl_rgb.ckpt on an fp16 SD1.5 model.

Amp-Thread-ID: https://ampcode.com/threads/T-019e947a-9fd3-76df-a847-5eb68d7f18de
Co-authored-by: Amp <amp@ampcode.com>
2026-06-04 15:10:48 -07:00
Jedrzej KosinskiandAmp 71b536c47f Fix dtype mismatch for SparseCtrl and SVD-ControlNet models
load_sparsectrl and load_svdcontrolnet never set controlnet_config["dtype"],
so the control model was built with dtype=None (float32) while the UNet runs
in fp16. This caused "mat1 and mat2 must have the same dtype, but got Half and
Float" at sampling time (notably for .pth/.ckpt SparseCtrl models).

Set controlnet_config["dtype"] = unet_dtype before building the model, matching
the existing ControlNet++ and CtrLoRA loaders and ComfyUI's own controlnet loader.

Fixes #574

Amp-Thread-ID: https://ampcode.com/threads/T-019e947a-9fd3-76df-a847-5eb68d7f18de
Co-authored-by: Amp <amp@ampcode.com>
2026-06-04 14:26:17 -07:00
Jedrzej KosinskiandAmp fd0acd2b50 fix: update cast_bias_weight to use offloadable=True in clean_groupnorm
Use ComfyUI's updated 3-return-value cast_bias_weight API with
offloadable=True and call uncast_bias_weight after use for proper
async-offload support.

Co-authored-by: Amp <amp@ampcode.com>
Amp-Thread-ID: https://ampcode.com/threads/T-019d3bef-9580-7798-aec3-7a009a0f62a4
2026-03-29 18:37:59 -07:00
Jedrzej Kosinski 79f8a8aa8b Fixed device mismatch issue for ControlNet++, SparseCtrl, and SVDControlNet 2025-08-06 12:59:25 -07:00
Jedrzej Kosinski 0da13ac0e2 Updated the remaining context= controlnet code to use comfy.model_management.cast_to_device calls 2025-08-05 13:43:52 -07:00
German Chaverri f980ae7c7b Apply fix for ControlNet conditioning to match changes from ComfyUI 140ffc7fdc53e810030f060e421c1f528c2d2ab9 2025-08-05 11:00:08 -06:00
Jedrzej Kosinski afc96718fb Merge branch 'main' into multigpu 2025-01-31 04:00:44 -06:00
Jedrzej Kosinski 60a937144e Fixed BIGMAX_TENSOR to not be so big that it becomes an int64 instead of a float32, version bump 2025-01-31 03:59:05 -06:00
Jedrzej Kosinski 7fbcf03843 Values related to ad_params now obtained through transformer_options in get_control_inject, no longer requiring ADE to manually set them 2025-01-29 09:16:39 -06:00
LynnHo 008538346c Fix CtrLoRA preprocessor 2025-01-09 22:13:28 +08:00
Jedrzej Kosinski ab6526fa35 Fixed backwards compatibility for new KF scheduling behavior, changes "sigmas" to "sample_sigmas" to match incoming ComfyUI PR 2025-01-05 15:32:51 -06:00
Jedrzej Kosinski 52b2751025 Increment ACN DinkLink version due to need for transformer_options in prepare_current_timestep function 2025-01-04 00:36:21 -06:00
Jedrzej Kosinski 787c841b6b Make TimestepKeyframes work consistently across separated sampling nodes/code 2024-12-30 16:59:53 -06:00
Jedrzej Kosinski 840b3f9423 Add link to CtrLoRA repo on top of control_ctrlora.py file 2024-12-28 14:45:03 -06:00
Jedrzej Kosinski 393bca416d Fix Load CtrLoRA Model node being in the wrong category 2024-12-28 14:43:23 -06:00
Jedrzej Kosinski 5900f458f8 Fix regression of Load ControlNet++ Model (Multi) node 2024-12-07 05:06:41 -06:00
Jedrzej Kosinski 3ad082b691 Refactored SparseCtrlAdvanced to not save a reference to the actual ModelPatcher, just in case it's messing with memory management 2024-12-01 20:35:32 -06:00
Jedrzej Kosinski 4618d8006f Just in case make sure cleanup is called on motion model for SparseCtrl 2024-12-01 20:06:38 -06:00
Jedrzej Kosinski 37b318debc Refacotr SparseCtrl to depend on AnimateDiff-Evolved for AnimateDiffModel definition/creation; allows for code to not be duplicated and any feature that works for AD can be resued/exposed for SparseCtrl 2024-12-01 19:46:47 -06:00
Jedrzej Kosinski e5f7f5a281 Refactored DinkLink acn wrapper registration to not cause circular import 2024-11-29 22:40:20 -06:00
Jedrzej Kosinski c59f99efbc Add ControlNetSD35Advanced, port over changes from vanilla ControlNet to ControlNetAdvanced to support ControlNetSD35 2024-11-27 00:52:52 -06:00
Jedrzej Kosinski dc91f47aed Add middle_mult extra via Middle Weight Extras node 2024-11-26 20:21:53 -06:00
Jedrzej Kosinski 8db35a7963 Clean up TimestepKeyframeGroup cloning so it does not keep on adding a useless default keyframe to clone each time it's called 2024-11-26 19:05:51 -06:00
Jedrzej Kosinski d255167dca Fixed soft/custom weights not affecting flux by disabling applied_to optimization when needed, fixed missing transformer_options input into default_control_actions 2024-11-26 00:02:42 -06:00
Jedrzej Kosinski 999763ce69 Add real_compression_ratio so can be adjusted to properly check for expected cond_hint size 2024-11-25 21:52:51 -06:00
Jedrzej Kosinski 72f0e6dbac Add initial CtrLoRA support, fix issue with vae not being set, add a way to disable multiplying compression_ratio by vae.downscale_ratio when not needed 2024-11-25 20:33:53 -06:00
Jedrzej Kosinski df899e8b7e Make forward_inject_UNetModel a built-in diffusion_model wrapper instead to fix weird issue with ContextRef + ImageInjection 2024-11-17 08:35:48 -06:00
Jedrzej Kosinski a2430fb880 Add clarifying comment so I don't accidentally cause regression in the future with new memory management system 2024-11-14 20:02:51 -06:00
Jedrzej Kosinski 285f41c809 Cleaned up some commented out code from control_lllite.py file 2024-11-14 15:20:48 -06:00
Jedrzej Kosinski 326b26ed95 Simplified ControlLLLite implementation, since transformer_options are passed into get_control with ComfyUI rework 2024-11-14 12:10:28 -06:00
Jedrzej Kosinski b9c53b79c9 Fix from_vanilla call for ControlNetAdvanced so it does not break ComfyUI memory management system; parent model patcher has to be tracked properly now 2024-11-14 11:49:56 -06:00
Jedrzej Kosinski 7f84e973d6 Converted sampler_sample_wrapper to a outer_sample_wrapper so that controlnet prerun can be ran properly 2024-11-14 10:53:59 -06:00
Jedrzej Kosinski 52f8220260 Started to replace anc_sample_factory with acn_sampler_sample_wrapper WrapperHook, ReferenceCN now can respect individual conds 2024-11-14 08:12:54 -06:00
Jedrzej Kosinski 57dfa7d1ce Cleaned imports in nodes.py 2024-11-14 04:58:23 -06:00
Jedrzej Kosinski 820a591687 Replaced base Load Advanced ControlNet Model nodes with ones with cnet instead of control_net_name to leave more room for CN name 2024-11-14 04:57:12 -06:00
Jedrzej Kosinski 828c270a85 Moved autosize to hidden props instead of optional to make use of AustinMroz's revised js, fixed outdated autosize values 2024-11-14 04:13:38 -06:00
Jedrzej Kosinski 1d14382944 Updated Aoply Advanced ControlNet nodes to remove long unnecessaru model_optional fields, shifted some of the nodes.py code around to separate files to make deprecation cleaner 2024-11-14 04:04:21 -06:00
Jedrzej Kosinski 3120c14e0a Added checks for None control_net to produce more helpful error messages for users 2024-11-14 03:48:42 -06:00
Jedrzej Kosinski f42c902fd4 Fixed checks for special preprocessor input (ReferenceCN and RGB SparseCtrl), continued work on DinkLink 2024-11-14 03:42:29 -06:00
Jedrzej Kosinski 74320a78e3 Replaced SparseModelPatcher with native ModelPatcher and callbacks 2024-11-12 18:14:21 -06:00
Jedrzej Kosinski c7aa168691 Added DinkLink scaffolding 2024-11-12 18:13:17 -06:00
Jedrzej Kosinski 5505370c43 Merge branch 'main' into rework-modelpatcher 2024-10-31 18:30:14 -05:00
pharmapsychotic 6d00ede674 device is no longer a parameter to constructor for ControlBase 2024-10-31 23:12:46 +00:00
Jedrzej Kosinski 1dc1b648ce Some progress on future acn_sampler_sample_wrapper 2024-10-25 15:45:00 -05:00
Jedrzej Kosinski 767cbf3dcc Merge branch 'main' into rework-modelpatcher 2024-10-23 22:02:47 -05:00
Jedrzej Kosinski 95e26b9b79 Made code work with new ComfyUI changes (device var removed from ControlBase) 2024-10-23 21:57:39 -05:00
Jedrzej Kosinski 7d25e4bafb Ported ContextRef adain support to work with uuids, reorganized the ContextRef-related code in BankStyle classes 2024-10-11 09:43:06 -05:00