Views
No views yet
git checkout dev_upstream_experimental;1import torch
2from diffusers import StableDiffusionXLPipeline, EulerAncestralDiscreteScheduler
3
4ckpt_path = "/path/to/model.safetensors"
5pipe = StableDiffusionXLPipeline.from_single_file(
6 ckpt_path,
7 use_safetensors=True,
8 torch_dtype=torch.float16,
9)
10pipe.scheduler = EulerAncestralDiscreteScheduler.from_config(pipe.scheduler.config)
11pipe.scheduler.register_to_config(
12 prediction_type="v_prediction",
13 rescale_betas_zero_snr=True,
14)
15pipe.enable_xformers_memory_efficient_attention()
16pipe = pipe.to("cuda")
17
18prompt = "best quality, 1boy, solo"
19negative_prompt = "bad hands, worst quality, low quality, bad quality, multiple views, 4koma, comic, jpeg artifacts, monochrome, sepia, greyscale, flat color, pale color, muted color, low contrast, bad anatomy, picture frame, english text, signature, watermark, logo, patreon username, web address, artist name"
20
21image = pipe(
22 prompt=prompt,
23 negative_prompt=negative_prompt,
24 width=832,
25 height=1216,
26 num_inference_steps=28,
27 guidance_scale=7.0,
28 generator=torch.Generator().manual_seed(42),
29
30).images[0]
31
32image.save('image.png')