gads
Browse files
F
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import torch
|
| 2 |
+
from diffusers import (
|
| 3 |
+
StableDiffusionXLPipeline,
|
| 4 |
+
EulerAncestralDiscreteScheduler,
|
| 5 |
+
AutoencoderKL
|
| 6 |
+
)
|
| 7 |
+
|
| 8 |
+
# Load VAE component
|
| 9 |
+
vae = AutoencoderKL.from_pretrained(
|
| 10 |
+
"madebyollin/sdxl-vae-fp16-fix",
|
| 11 |
+
torch_dtype=torch.float16
|
| 12 |
+
)
|
| 13 |
+
|
| 14 |
+
# Configure the pipeline
|
| 15 |
+
pipe = StableDiffusionXLPipeline.from_pretrained(
|
| 16 |
+
"cagliostrolab/animagine-xl-3.0",
|
| 17 |
+
vae=vae,
|
| 18 |
+
torch_dtype=torch.float16,
|
| 19 |
+
use_safetensors=True,
|
| 20 |
+
)
|
| 21 |
+
pipe.scheduler = EulerAncestralDiscreteScheduler.from_config(pipe.scheduler.config)
|
| 22 |
+
pipe.to('cuda')
|
| 23 |
+
|
| 24 |
+
# Define prompts and generate image
|
| 25 |
+
prompt = "1girl, arima kana, oshi no ko, solo, upper body, v, smile, looking at viewer, outdoors, night"
|
| 26 |
+
negative_prompt = "nsfw, lowres, bad anatomy, bad hands, text, error, missing fingers, extra digit, fewer digits, cropped, worst quality, low quality, normal quality, jpeg artifacts, signature, watermark, username, blurry, artist name"
|
| 27 |
+
|
| 28 |
+
image = pipe(
|
| 29 |
+
prompt,
|
| 30 |
+
negative_prompt=negative_prompt,
|
| 31 |
+
width=832,
|
| 32 |
+
height=1216,
|
| 33 |
+
guidance_scale=7,
|
| 34 |
+
num_inference_steps=28
|
| 35 |
+
).images[0]
|