Skip to content

Commit

Permalink
fix(api): update VAE tiling params every time pipeline is used
Browse files Browse the repository at this point in the history
  • Loading branch information
ssube committed May 6, 2023
1 parent 2cb03cb commit 98f99b1
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions api/onnx_web/diffusers/load.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,18 +125,6 @@ def load_pipeline(
logger.debug("reusing existing diffusion pipeline")
pipe = cache_pipe

cache_pipe.vae_encoder.set_tiled(tiled=params.tiled_vae)
cache_pipe.vae_decoder.set_tiled(tiled=params.tiled_vae)

# update panorama params
if pipeline == "panorama":
latent_window = params.tiles // 8
latent_stride = params.stride // 8

cache_pipe.set_window_size(latent_window, latent_stride)
cache_pipe.vae_encoder.set_window_size(latent_window, params.overlap)
cache_pipe.vae_decoder.set_window_size(latent_window, params.overlap)

# update scheduler
cache_scheduler = server.cache.get("scheduler", scheduler_key)
if cache_scheduler is None:
Expand Down Expand Up @@ -363,6 +351,18 @@ def load_pipeline(
server.cache.set("diffusion", pipe_key, pipe)
server.cache.set("scheduler", scheduler_key, components["scheduler"])

pipe.vae_encoder.set_tiled(tiled=params.tiled_vae)
pipe.vae_decoder.set_tiled(tiled=params.tiled_vae)

# update panorama params
if pipeline == "panorama":
latent_window = params.tiles // 8
latent_stride = params.stride // 8

pipe.set_window_size(latent_window, latent_stride)
pipe.vae_encoder.set_window_size(latent_window, params.overlap)
pipe.vae_decoder.set_window_size(latent_window, params.overlap)

return pipe


Expand Down

0 comments on commit 98f99b1

Please sign in to comment.