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

Output has NaN #9

Open
ZhongliangGuo opened this issue Jul 17, 2024 · 2 comments
Open

Output has NaN #9

ZhongliangGuo opened this issue Jul 17, 2024 · 2 comments

Comments

@ZhongliangGuo
Copy link

Hi, I tried the pipe with several images, I found that, when the image has a white background, the pipe may output a black image. There is a warning like:
"diffusers/image_processor.py:97: RuntimeWarning: invalid value encountered in cast images = (images * 255).round().astype("uint8")"

I think that maybe the pipe output a value where not a number? I attached the example image, whatever the random seed I used, it always return a black image. (including my 2 servers, 2 pc, and your hugging face demo)

ILSVRC2012_val_00001689

Could you please help me to solve this problem? I have the same environment as your requirements.txt.

@lightChaserX
Copy link

I suppose it is caused by the image with a pure color background and the regularization. You may try to disable the regularization by setting noise_regularization_num_reg_steps to 0

@loggerJK
Copy link

You may try this at src/renoise_inversion.py:15

_grad = torch.clip(_grad, -100, 100)
if torch.isnan(_grad).any():
    warnings.warn("NaN detected in l_kld")
else :
    e_t = e_t - lambda_kl * _grad

which does not update e_t if NaN is detected.

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

3 participants