Generate multi-view images from a single image
mainUse the DiffusionPipeline with the sudo-ai/zero123plus-pipeline custom pipeline to generate consistent multi-view images.
Requirements:
- Input image must be square.
- Recommended resolution:
>=320x320. - VRAM: ~5GB.
Inference Steps:
- General objects: ~28 steps.
- Delicate details (faces, anime): 75-100 steps.
Note on Scheduler: It is recommended to use diffusers==0.20.2 to support the timestep_spacing='trailing' parameter in the EulerAncestralDiscreteScheduler.
import torch
import requests
from PIL import Image
from diffusers import DiffusionPipeline, EulerAncestralDiscreteScheduler
# Load the pipeline
pipeline = DiffusionPipeline.from_pretrained(
"sudo-ai/zero123plus-v1.1", custom_pipeline="sudo-ai/zero123plus-pipeline",
torch_dtype=torch.float16
)
# Tune the scheduler
pipeline.scheduler = EulerAncestralDiscreteScheduler.from_config(
pipeline.scheduler.config, timestep_spacing='trailing'
)
pipeline.to('cuda:0')
# Load input image
cond = Image.open(requests.get("https://d.skis.ltd/nrp/sample-data/lysol.png", stream=True).raw)
# Run the pipeline
result = pipeline(cond, num_inference_steps=75).images[0]
result.show()
result.save("output.png")