auto-git:

[change] generate_equirect.py
This commit is contained in:
2026-05-07 10:45:03 +02:00
parent 2a2e72eda7
commit c36d5e66b8

View File

@@ -358,6 +358,7 @@ def generate(
).to(device)
base_pipe.unet = unet
gen_pipe = base_pipe
del base_pipe, unet
else:
gen_pipe = StableDiffusionXLPipeline.from_pretrained(
model_path,
@@ -440,8 +441,12 @@ def generate(
"Try one of: euler, euler_a, heun, ddim, dpmsolver, dpmsolver-sde."
)
gen_pipe.enable_attention_slicing()
if is_sdxl and vae is not None and hasattr(gen_pipe, "enable_vae_tiling"):
if hasattr(gen_pipe, "enable_vae_tiling"):
gen_pipe.enable_vae_tiling()
if hasattr(gen_pipe, "enable_vae_slicing"):
gen_pipe.enable_vae_slicing()
if "pipe_kwargs" in locals():
del pipe_kwargs
def progress_cb(phase: str, current: int, total: int):
payload = {
@@ -463,7 +468,19 @@ def generate(
height=height,
callback_steps=1,
callback=lambda step, timestep, kwargs: progress_cb("gen", step + 1, steps),
).images[0]
output_type="latent",
)
latents = latent_output.images.detach().cpu()
decoder_vae = gen_pipe.vae
vae = None
del latent_output, gen_pipe
clear_torch_cache(device)
progress_cb("decode", 0, 1)
image = decode_latents_to_image(decoder_vae, latents, device)
progress_cb("decode", 1, 1)
del latents, decoder_vae
clear_torch_cache(device)
gen_path = os.path.join(tempdir, f"base_{width}x{height}.png")
image.save(gen_path)