multimodalart HF Staff commited on
Commit
d2db40e
·
verified ·
1 Parent(s): e835f7f

Upload app.py with huggingface_hub

Browse files
Files changed (1) hide show
  1. app.py +6 -0
app.py CHANGED
@@ -220,6 +220,12 @@ def _generate(prompt_embeds, seed, steps, switch, hr_steps, feather, alpha, use_
220
  alpha=float(alpha), feather=float(feather), hr_steps=int(hr_steps),
221
  latent_t=latent_t, switch_upscale="crop", final="pixel",
222
  )
 
 
 
 
 
 
223
  if "lr" in info: # render()'s guard: the merge inputs exist only on the two-track path
224
  pixels = pixel_compose(UPSCALE.vae, latent, info["lr"], info["weight"])
225
  else:
 
220
  alpha=float(alpha), feather=float(feather), hr_steps=int(hr_steps),
221
  latent_t=latent_t, switch_upscale="crop", final="pixel",
222
  )
223
+ # The sampler's dual-resolution activations are freed on return, but the caching allocator
224
+ # still holds their segments (~20 GB): hand them back before the merge or the VAE decode
225
+ # starts with ~0 bytes free and dies on PyTorch's NVML assert (it OOM'd the first live run
226
+ # here even at the port's measured 22-frame size). The vendored code uses this same
227
+ # empty_cache() idiom at its own stage boundaries.
228
+ torch.cuda.empty_cache()
229
  if "lr" in info: # render()'s guard: the merge inputs exist only on the two-track path
230
  pixels = pixel_compose(UPSCALE.vae, latent, info["lr"], info["weight"])
231
  else: