Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: A tensor with all NaNs was produced in VAE without --no-half #352

Open
2 tasks done
coollofty opened this issue Nov 30, 2023 · 6 comments
Open
2 tasks done

Comments

@coollofty
Copy link

Is there an existing issue for this?

  • I have searched the existing issues and checked the recent builds/commits of both this extension and the webui

Have you read FAQ on README?

  • I have updated WebUI and this extension to the latest version

What happened?

animate diff render a black image. If I started with command --no-half, then it is ok! --no-half-vae only is no effect, must together --no-half. But none of the other functions are available without --no-half.

Steps to reproduce the problem

The simplest way is to set the parameters for animation diff and draw a few frames

What should have happened?

black image

Commit where the problem happens

webui:
extension:

What browsers do you use to access the UI ?

No response

Command Line Arguments

--theme dark --xformers --xformers-flash-attention --no-half-vae --opt-channelslast --api --listen

Console logs

Traceback (most recent call last):
      File "G:\sd-std\modules\call_queue.py", line 57, in f
        res = list(func(*args, **kwargs))
      File "G:\sd-std\modules\call_queue.py", line 36, in f
        res = func(*args, **kwargs)
      File "G:\sd-std\modules\txt2img.py", line 55, in txt2img
        processed = processing.process_images(p)
      File "G:\sd-std\modules\processing.py", line 734, in process_images
        res = process_images_inner(p)
      File "G:\sd-std\extensions\sd-webui-animatediff\scripts\animatediff_cn.py", line 119, in hacked_processing_process_images_hijack
        return getattr(processing, '__controlnet_original_process_images_inner')(p, *args, **kwargs)
      File "G:\sd-std\modules\processing.py", line 877, in process_images_inner
        x_samples_ddim = decode_latent_batch(p.sd_model, samples_ddim, target_device=devices.cpu, check_for_nans=True)
      File "G:\sd-std\modules\processing.py", line 603, in decode_latent_batch
        raise e
      File "G:\sd-std\modules\processing.py", line 600, in decode_latent_batch
        devices.test_for_nans(sample, "vae")
      File "G:\sd-std\modules\devices.py", line 193, in test_for_nans
        raise NansException(message)

modules.devices.NansException: A tensor with all NaNs was produced in VAE. Use --disable-nan-check commandline argument to disable this check.

Additional information

No response

@coollofty
Copy link
Author

I means that my base model is fp16, and when using animate diff, it is must add both -- no-half and -- no-half-vae at the same time, otherwise an "A tensor with all NaNs was produced in VAE" error will occur. Is there a solution to this?

@PentagramPro
Copy link

I have same issue

@eduardonba1
Copy link

I have the same problem sometimes
i kept pressing generate and worked lol

@SeanBannister
Copy link

I get this error when I set "Number of frames" to 3 while FPS was set to 30. Setting my "Number of frames" higher than my FPS fixed this.

@NaughtDZ
Copy link

I means that my base model is fp16, and when using animate diff, it is must add both -- no-half and -- no-half-vae at the same time, otherwise an "A tensor with all NaNs was produced in VAE" error will occur. Is there a solution to this?

Same problem here,and no solution by now as I know....

@continue-revolution
Copy link
Owner

@SeanBannister describes the way to resolve this issue. This issue is actually the same as #213 (comment) here (an older issue). Unfortunately there is no solution. Please always keep your "Number of frames" to be greater than or equal to your "Context batch size".

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants