CoolFace
Modelpublic

diffusers/tools

sourceHugging Facecreativeml-openrail-mupdated 3y agoView on Hugging Face
11likes27downloads
new_scheduler.py23 linesDownload Raw Back to root
1#!/usr/bin/env python32from diffusers import DiffusionPipeline, EulerAncestralDiscreteScheduler3import torch4 5path = "runwayml/stable-diffusion-v1-5"6 7run_compile = False  # Set True / False8use_karras_sigmas = False9 10pipe = DiffusionPipeline.from_pretrained(path, torch_dtype=torch.float16)11pipe = pipe.to("cuda")12pipe.scheduler = EulerAncestralDiscreteScheduler.from_config(pipe.scheduler.config, use_karras_sigmas=use_karras_sigmas)13pipe.unet.to(memory_format=torch.channels_last)14 15if run_compile:16    print("Run torch compile")17    pipe.unet = torch.compile(pipe.unet, mode="reduce-overhead", fullgraph=True)18 19prompt = "ghibli style, a fantasy landscape with castles"20 21for _ in range(3):22    images = pipe(prompt=prompt).images23