1import torch
2from diffusers import StableDiffusionPipeline
3from torch import autocast
45pipe = StableDiffusionPipeline.from_pretrained("wx44wx/sd-three-kingdoms-diffusers", torch_dtype=torch.float16)6pipe = pipe.to("cuda")78prompt ="a man in armor"9scale =310n_samples =41112# Sometimes the nsfw checker is confused by the Pokémon images, you can disable13# it at your own risk here14disable_safety =False1516if disable_safety:17defnull_safety(images,**kwargs):18return images,False19 pipe.safety_checker = null_safety
2021with autocast("cuda"):22 images = pipe(n_samples*[prompt], guidance_scale=scale).images
2324for idx, im inenumerate(images):25 im.save(f"{idx:06}.png")