svjack commited on
Commit
82fad2d
·
verified ·
1 Parent(s): 3416f50

Create run_civitai_sdxl.py

Browse files
Files changed (1) hide show
  1. run_civitai_sdxl.py +30 -0
run_civitai_sdxl.py ADDED
@@ -0,0 +1,30 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import torch
2
+ from diffusers import StableDiffusionXLPipeline
3
+ from diffusers import EulerDiscreteScheduler
4
+
5
+ ckpt_path = "noobaiXLNAIXL_vPred10Version.safetensors" #### https://civitai.com/models/833294
6
+ ckpt_path = "nyaflow-xl-alpha.safetensors" #### https://huggingface.co/nyanko7/nyaflow-xl-alpha
7
+ pipe = StableDiffusionXLPipeline.from_single_file(
8
+ ckpt_path,
9
+ use_safetensors=True,
10
+ torch_dtype=torch.float16,
11
+ )
12
+ scheduler_args = {"prediction_type": "v_prediction", "rescale_betas_zero_snr": True}
13
+ pipe.scheduler = EulerDiscreteScheduler.from_config(pipe.scheduler.config, **scheduler_args)
14
+ pipe.enable_xformers_memory_efficient_attention()
15
+ pipe = pipe.to("cuda")
16
+
17
+ prompt = """masterpiece, best quality,artist:john_kafka,artist:nixeu,artist:quasarcake, chromatic aberration, film grain, horror \(theme\), limited palette, x-shaped pupils, high contrast, color contrast, cold colors, arlecchino \(genshin impact\), black theme, gritty, graphite \(medium\)"""
18
+ prompt = "zhongli"
19
+ negative_prompt = "nsfw, worst quality, old, early, low quality, lowres, signature, username, logo, bad hands, mutated hands, mammal, anthro, furry, ambiguous form, feral, semi-anthro"
20
+
21
+ image = pipe(
22
+ prompt=prompt,
23
+ negative_prompt=negative_prompt,
24
+ width=832,
25
+ height=1216,
26
+ num_inference_steps=28,
27
+ guidance_scale=5,
28
+ generator=torch.Generator().manual_seed(42),
29
+ ).images[0]
30
+ image