mirror of
https://github.com/vladmandic/automatic
synced 2026-09-19 17:24:32 +02:00
Finish TODO fix script
This commit is contained in:
@@ -66,14 +66,15 @@ def process_diffusers(p: processing.StableDiffusionProcessing):
|
||||
time.sleep(0.1)
|
||||
if kwargs.get('latents', None) is None:
|
||||
return kwargs
|
||||
if True: # TODO: IP adapter active
|
||||
if getattr(p, "ip_adapter_names", ["None"])[0] != "None":
|
||||
ip_adapter_scales = list(p.ip_adapter_scales)
|
||||
ip_adapter_starts = list(p.ip_adapter_starts)
|
||||
ip_adapter_ends = list(p.ip_adapter_ends)
|
||||
if any(end != 1 for end in ip_adapter_ends) or any(start != 0 for start in ip_adapter_starts):
|
||||
for i in range(len(ip_adapter_scales)):
|
||||
ip_adapter_scales[i] = 0 if step <= int(pipe.num_timesteps * ip_adapter_starts[i]) else ip_adapter_scales[i] # TODO: Convert to bool list?
|
||||
ip_adapter_scales[i] = 0 if step >= int(pipe.num_timesteps * ip_adapter_ends[i]) else ip_adapter_scales[i]
|
||||
ip_adapter_scales[i] *= float(step >= pipe.num_timesteps * ip_adapter_starts[i])
|
||||
ip_adapter_scales[i] *= float(step <= pipe.num_timesteps * ip_adapter_ends[i])
|
||||
debug(f"Callback: IP Adapter scales={ip_adapter_scales}")
|
||||
pipe.set_ip_adapter_scale(ip_adapter_scales)
|
||||
if step != pipe.num_timesteps:
|
||||
kwargs = processing_correction.correction_callback(p, timestep, kwargs)
|
||||
|
||||
@@ -71,14 +71,14 @@ class Script(scripts.Script):
|
||||
return
|
||||
args = list(args)
|
||||
units = args.pop(0)
|
||||
if p.ip_adapter_names is None:
|
||||
if p.ip_adapter_names == []:
|
||||
p.ip_adapter_names = args[:MAX_ADAPTERS][:units]
|
||||
if p.ip_adapter_scales == 0.0:
|
||||
if p.ip_adapter_scales == [0.0]:
|
||||
p.ip_adapter_scales = args[MAX_ADAPTERS:MAX_ADAPTERS*2][:units]
|
||||
if p.ip_adapter_images is None:
|
||||
if p.ip_adapter_images == []:
|
||||
p.ip_adapter_images = args[MAX_ADAPTERS*2:MAX_ADAPTERS*3][:units]
|
||||
if p.ip_adapter_starts is None:
|
||||
if p.ip_adapter_starts == [0.0]:
|
||||
p.ip_adapter_starts = args[MAX_ADAPTERS*3:MAX_ADAPTERS*4][:units]
|
||||
if p.ip_adapter_ends is None:
|
||||
if p.ip_adapter_ends == [1.0]:
|
||||
p.ip_adapter_ends = args[MAX_ADAPTERS*4:MAX_ADAPTERS*5][:units]
|
||||
# ipadapter.apply(shared.sd_model, p, adapter_name, scale, image) # called directly from processing.process_images_inner
|
||||
|
||||
Reference in New Issue
Block a user