Refactoring.
This commit is contained in:
parent
a5adb6b9fb
commit
b0862045ca
26
sd_cli.py
26
sd_cli.py
@ -104,30 +104,24 @@ class StableDiffusion:
|
|||||||
|
|
||||||
torch.backends.cuda.matmul.allow_tf32 = True
|
torch.backends.cuda.matmul.allow_tf32 = True
|
||||||
|
|
||||||
scheduler = diffusers.EulerAncestralDiscreteScheduler.from_pretrained(
|
self.pipe = diffusers.StableDiffusionPipeline.from_pretrained(
|
||||||
|
cache_path,
|
||||||
|
custom_pipeline="lpw_stable_diffusion",
|
||||||
|
torch_dtype=torch.float16,
|
||||||
|
)
|
||||||
|
|
||||||
|
self.pipe.scheduler = diffusers.EulerAncestralDiscreteScheduler.from_pretrained(
|
||||||
cache_path,
|
cache_path,
|
||||||
subfolder="scheduler",
|
subfolder="scheduler",
|
||||||
)
|
)
|
||||||
|
|
||||||
if os.environ["USE_VAE"] == "true":
|
if os.environ["USE_VAE"] == "true":
|
||||||
vae = diffusers.AutoencoderKL.from_pretrained(
|
self.pipe.vae = diffusers.AutoencoderKL.from_pretrained(
|
||||||
cache_path,
|
cache_path,
|
||||||
subfolder="vae",
|
subfolder="vae",
|
||||||
)
|
)
|
||||||
self.pipe = diffusers.StableDiffusionPipeline.from_pretrained(
|
|
||||||
cache_path,
|
self.pipe.to("cuda")
|
||||||
scheduler=scheduler,
|
|
||||||
vae=vae,
|
|
||||||
custom_pipeline="lpw_stable_diffusion",
|
|
||||||
torch_dtype=torch.float16,
|
|
||||||
).to("cuda")
|
|
||||||
else:
|
|
||||||
self.pipe = diffusers.StableDiffusionPipeline.from_pretrained(
|
|
||||||
cache_path,
|
|
||||||
scheduler=scheduler,
|
|
||||||
custom_pipeline="lpw_stable_diffusion",
|
|
||||||
torch_dtype=torch.float16,
|
|
||||||
).to("cuda")
|
|
||||||
|
|
||||||
if os.environ["LORA_NAMES"] != "":
|
if os.environ["LORA_NAMES"] != "":
|
||||||
lora_names = os.getenv("LORA_NAMES").split(",")
|
lora_names = os.getenv("LORA_NAMES").split(",")
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user