diffusers/tools
1128
1#!/usr/bin/env python32import torch3 4from diffusers import ConsistencyModelPipeline, UNet2DModel5 6device = "cpu"7# Load the cd_bedroom256_lpips checkpoint.8model_id_or_path = "openai/diffusers-cd_bedroom256_lpips"9pipe = ConsistencyModelPipeline.from_pretrained(model_id_or_path)10pipe.to(device)11 12# Multistep sampling13# Timesteps can be explicitly specified; the particular timesteps below are from the original Github repo:14# https://github.com/openai/consistency_models/blob/main/scripts/launch.sh#L8315for _ in range(10):16 image = pipe(timesteps=[17, 0]).images[0]17 image.show()18 19 