mirror of
https://github.com/vladmandic/automatic
synced 2026-09-19 17:24:32 +02:00
qwen multi-image edits
Signed-off-by: Vladimir Mandic <mandic00@live.com>
This commit is contained in:
@@ -123,9 +123,11 @@ def task_specific_kwargs(p, model):
|
||||
}
|
||||
|
||||
# model specific args
|
||||
if 'QwenImageEdit' in model_cls and len(getattr(p, 'init_images', [])) == 0:
|
||||
if 'QwenImageEdit' in model_cls and (p.init_images is None or len(p.init_images) == 0):
|
||||
task_args['image'] = [Image.new('RGB', (p.width, p.height), (0, 0, 0))] # monkey-patch so qwen-image-edit pipeline does not error-out on t2i
|
||||
if 'LatentConsistencyModelPipeline' in model_cls and hasattr(p, 'init_images') and len(p.init_images) > 0:
|
||||
if 'QwenImageEditPlusPipeline' in model_cls and p.init_control is not None and len(p.init_control) > 0:
|
||||
task_args['image'] += p.init_control
|
||||
if 'LatentConsistencyModelPipeline' in model_cls and len(p.init_images) > 0:
|
||||
p.ops.append('lcm')
|
||||
init_latents = [processing_vae.vae_encode(image, model=shared.sd_model, vae_type=p.vae_type).squeeze(dim=0) for image in p.init_images]
|
||||
init_latent = torch.stack(init_latents, dim=0).to(shared.device)
|
||||
@@ -133,11 +135,11 @@ def task_specific_kwargs(p, model):
|
||||
init_latent = (1 - p.denoising_strength) * init_latent + init_noise
|
||||
task_args = {
|
||||
'latents': init_latent.to(model.dtype),
|
||||
'width': p.width if hasattr(p, 'width') else None,
|
||||
'height': p.height if hasattr(p, 'height') else None,
|
||||
'width': p.width,
|
||||
'height': p.height,
|
||||
}
|
||||
if 'BlipDiffusionPipeline' in model_cls:
|
||||
if len(getattr(p, 'init_images', [])) == 0:
|
||||
if len(p.init_images) == 0:
|
||||
shared.log.error('BLiP diffusion requires init image')
|
||||
return task_args
|
||||
task_args = {
|
||||
@@ -146,9 +148,9 @@ def task_specific_kwargs(p, model):
|
||||
'target_subject_category': getattr(p, 'prompt', '').split()[-1],
|
||||
'output_type': 'pil',
|
||||
}
|
||||
if ('WanImageToVideoPipeline' in model_cls) and (getattr(p, 'init_images', None) is not None) and (len(p.init_images) > 0):
|
||||
if ('WanImageToVideoPipeline' in model_cls) and (p.init_images is not None) and (len(p.init_images) > 0):
|
||||
task_args['image'] = p.init_images[0]
|
||||
if ('WanVACEPipeline' in model_cls) and (getattr(p, 'init_images', None) is not None) and (len(p.init_images) > 0):
|
||||
if ('WanVACEPipeline' in model_cls) and (p.init_images is not None) and (len(p.init_images) > 0):
|
||||
task_args['reference_images'] = p.init_images
|
||||
|
||||
if debug_enabled:
|
||||
|
||||
Reference in New Issue
Block a user