mirror of
https://github.com/AUTOMATIC1111/stable-diffusion-webui.git
synced 2025-08-04 03:10:21 +00:00
performance: check for nans in unet only once, after all steps have been completed
This commit is contained in:
@@ -625,6 +625,9 @@ class DecodedSamples(list):
|
||||
def decode_latent_batch(model, batch, target_device=None, check_for_nans=False):
|
||||
samples = DecodedSamples()
|
||||
|
||||
if check_for_nans:
|
||||
devices.test_for_nans(batch, "unet")
|
||||
|
||||
for i in range(batch.shape[0]):
|
||||
sample = decode_first_stage(model, batch[i:i + 1])[0]
|
||||
|
||||
@@ -987,6 +990,8 @@ def process_images_inner(p: StableDiffusionProcessing) -> Processed:
|
||||
if getattr(samples_ddim, 'already_decoded', False):
|
||||
x_samples_ddim = samples_ddim
|
||||
else:
|
||||
devices.test_for_nans(samples_ddim, "unet")
|
||||
|
||||
if opts.sd_vae_decode_method != 'Full':
|
||||
p.extra_generation_params['VAE Decoder'] = opts.sd_vae_decode_method
|
||||
x_samples_ddim = decode_latent_batch(p.sd_model, samples_ddim, target_device=devices.cpu, check_for_nans=True)
|
||||
|
Reference in New Issue
Block a user