CoolFace
Modelpublic

diffusers/tools

sourceHugging Facecreativeml-openrail-mupdated 3y agoView on Hugging Face
11likes28downloads
run_sd_compile.py21 linesDownload Raw Back to root
1#!/usr/bin/env python32from diffusers import StableDiffusionPipeline3import torch4 5path = "runwayml/stable-diffusion-v1-5"6 7run_compile = True  # Set True / False8 9pipe = StableDiffusionPipeline.from_pretrained(path, torch_dtype=torch.float16)10pipe = pipe.to("cuda:0")11pipe.unet.to(memory_format=torch.channels_last)12 13if run_compile:14    print("Run torch compile")15    pipe.unet = torch.compile(pipe.unet, mode="reduce-overhead", fullgraph=True)16 17prompt = "ghibli style, a fantasy landscape with castles"18 19for _ in range(3):20    images = pipe(prompt=prompt).images21