diff --git a/adv_control/control_reference.py b/adv_control/control_reference.py index f5fe8f1..cba8340 100644 --- a/adv_control/control_reference.py +++ b/adv_control/control_reference.py @@ -162,7 +162,7 @@ class ReferenceAdvanced(ControlBase, AdvancedControlBase): self.extra_hooks = extra_hooks.clone() if extra_hooks else self.import_and_create_wrapper_hooks() # ContextRef stuff self.is_context_ref = False - self.contextref_cond_idx = -1 + self.contextref_cond_idx = -1 # NOTE: does nothing ever since conds got uuids associated with them; can remove self.contextref_version = RETURNED_CONTEXTREF_VERSION @property diff --git a/adv_control/sampling.py b/adv_control/sampling.py index 7f2e9ec..104fa5d 100644 --- a/adv_control/sampling.py +++ b/adv_control/sampling.py @@ -18,9 +18,7 @@ from .control_reference import (ReferenceAdvanced, ReferenceInjections, handle_context_ref_setup, handle_reference_injection, REF_CONTROL_LIST_ALL, CONTEXTREF_CLEAN_FUNC) from .dinklink import get_dinklink -from .utils import torch_dfs, WrapperConsts - -CURRENT_WRAPPER_VERSION = 10001 +from .utils import torch_dfs, WrapperConsts, CURRENT_WRAPPER_VERSION def prepare_dinklink_acn_wrapper(): # expose acn_sampler_sample_wrapper diff --git a/adv_control/utils.py b/adv_control/utils.py index 4dc7363..d4221d0 100644 --- a/adv_control/utils.py +++ b/adv_control/utils.py @@ -35,6 +35,8 @@ def load_torch_file_with_dict_factory(controlnet_data: dict[str, Tensor], orig_l return load_torch_file_with_dict +CURRENT_WRAPPER_VERSION = 10002 + class WrapperConsts: ACN = "ACN" VERSION = "version" @@ -480,6 +482,8 @@ class WeightTypeException(TypeError): class AdvancedControlBase: + ACN_VERSION = CURRENT_WRAPPER_VERSION + def __init__(self, base: ControlBase, timestep_keyframes: TimestepKeyframeGroup, weights_default: ControlWeights, require_vae=False, allow_condhint_latents=False): self.base = base self.compatible_weights = [ControlWeightType.UNIVERSAL, ControlWeightType.DEFAULT] @@ -679,6 +683,11 @@ class AdvancedControlBase: self.batched_number = batched_number self.batch_size = len(t) self.cond_or_uncond = transformer_options.get("cond_or_uncond", None) + # fill out ad_param-related fields, if present + if "ad_params" in transformer_options: + self.sub_idxs = transformer_options["ad_params"]["sub_idxs"] + self.full_latent_length = transformer_options["ad_params"]["full_length"] + self.context_length = transformer_options["ad_params"]["context_length"] # prepare timestep and everything related self.prepare_current_timestep(t=t, transformer_options=transformer_options) # if should not perform any actions for the controlnet, exit without doing any work