Skip to content

Commit da254b7

Browse files
authored
Merge pull request #223 from Kosinkadink/multigpu
Get context-related info from ad_params in transformer_options
2 parents b66cd70 + 5d7012e commit da254b7

File tree

4 files changed

+12
-5
lines changed

4 files changed

+12
-5
lines changed

adv_control/control_reference.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ def __init__(self, ref_opts: ReferenceOptions, timestep_keyframes: TimestepKeyfr
162162
self.extra_hooks = extra_hooks.clone() if extra_hooks else self.import_and_create_wrapper_hooks()
163163
# ContextRef stuff
164164
self.is_context_ref = False
165-
self.contextref_cond_idx = -1
165+
self.contextref_cond_idx = -1 # NOTE: does nothing ever since conds got uuids associated with them; can remove
166166
self.contextref_version = RETURNED_CONTEXTREF_VERSION
167167

168168
@property

adv_control/sampling.py

+1-3
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,7 @@
1818
handle_context_ref_setup, handle_reference_injection,
1919
REF_CONTROL_LIST_ALL, CONTEXTREF_CLEAN_FUNC)
2020
from .dinklink import get_dinklink
21-
from .utils import torch_dfs, WrapperConsts
22-
23-
CURRENT_WRAPPER_VERSION = 10001
21+
from .utils import torch_dfs, WrapperConsts, CURRENT_WRAPPER_VERSION
2422

2523
def prepare_dinklink_acn_wrapper():
2624
# expose acn_sampler_sample_wrapper

adv_control/utils.py

+9
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,8 @@ def load_torch_file_with_dict(*args, **kwargs):
3535
return load_torch_file_with_dict
3636

3737

38+
CURRENT_WRAPPER_VERSION = 10002
39+
3840
class WrapperConsts:
3941
ACN = "ACN"
4042
VERSION = "version"
@@ -480,6 +482,8 @@ class WeightTypeException(TypeError):
480482

481483

482484
class AdvancedControlBase:
485+
ACN_VERSION = CURRENT_WRAPPER_VERSION
486+
483487
def __init__(self, base: ControlBase, timestep_keyframes: TimestepKeyframeGroup, weights_default: ControlWeights, require_vae=False, allow_condhint_latents=False):
484488
self.base = base
485489
self.compatible_weights = [ControlWeightType.UNIVERSAL, ControlWeightType.DEFAULT]
@@ -679,6 +683,11 @@ def get_control_inject(self, x_noisy, t, cond, batched_number, transformer_optio
679683
self.batched_number = batched_number
680684
self.batch_size = len(t)
681685
self.cond_or_uncond = transformer_options.get("cond_or_uncond", None)
686+
# fill out ad_param-related fields, if present
687+
if "ad_params" in transformer_options:
688+
self.sub_idxs = transformer_options["ad_params"]["sub_idxs"]
689+
self.full_latent_length = transformer_options["ad_params"]["full_length"]
690+
self.context_length = transformer_options["ad_params"]["context_length"]
682691
# prepare timestep and everything related
683692
self.prepare_current_timestep(t=t, transformer_options=transformer_options)
684693
# if should not perform any actions for the controlnet, exit without doing any work

pyproject.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[project]
22
name = "comfyui-advanced-controlnet"
33
description = "Nodes for scheduling ControlNet strength across timesteps and batched latents, as well as applying custom weights and attention masks."
4-
version = "1.5.3"
4+
version = "1.5.4"
55
license = { file = "LICENSE" }
66
dependencies = []
77

0 commit comments

Comments
 (0)