feat(anima): add image-to-image and inpainting support

This commit is contained in:
CalamitousFelicitousness
2026-04-30 03:43:08 +01:00
parent 079776bda6
commit a5bf29edbe
5 changed files with 178 additions and 2 deletions
+1 -1
View File
@@ -72,7 +72,7 @@ def get_model_type(pipe):
model_type = 'sana'
elif "HiDream" in name:
model_type = 'h1'
elif "AnimaTextToImage" in name:
elif name.startswith("Anima") and "AnimateDiff" not in name:
model_type = 'anima'
elif "Cosmos2TextToImage" in name:
model_type = 'cosmos'
+1 -1
View File
@@ -272,7 +272,7 @@ def set_pipeline_args(p, model, prompts:list, negative_prompts:list, prompts_2:l
kwargs['output_type'] = 'np' # only set latent if model has vae
# model specific
if 'Kandinsky' in model.__class__.__name__ or 'Cosmos2' in model.__class__.__name__ or 'Anima' in model.__class__.__name__ or 'OmniGen2' in model.__class__.__name__:
if 'Kandinsky' in model.__class__.__name__ or 'Cosmos2' in model.__class__.__name__ or 'OmniGen2' in model.__class__.__name__:
kwargs['output_type'] = 'np' # only set latent if model has vae
if 'StableCascade' in model.__class__.__name__:
kwargs.pop("guidance_scale") # remove
+2
View File
@@ -247,6 +247,8 @@ def vae_postprocess(tensor, model, output_type='np'):
if tensor.ndim == 6 and tensor.shape[1] == 1:
tensor = tensor.squeeze(0)
images = model.video_processor.postprocess_video(tensor, output_type='pil')
if isinstance(images, list) and len(images) > 0 and isinstance(images[0], list):
images = [frame for batch in images for frame in batch]
elif hasattr(model, 'image_processor'):
if tensor.ndim == 5 and tensor.shape[1] == 3: # Qwen Image
tensor = tensor[:, :, 0]