Comments (4)
Okay for those who are curious, I was able to fix it by making this change in the code, I think we were doing step twice in the same loop and it should be done once per loop right? correct me if I'm wrong here @johnowhitaker
Earlier code:
# Get the predicted x0:
latents_x0 = scheduler.step(noise_pred, t, latents).pred_original_sample # Using the scheduler (Diffusers 0.4 and above)
# compute the previous noisy sample x_t -> x_t-1
latents = scheduler.step(noise_pred, t, latents).prev_sample
Modified code (call step only once and use intermediate variable scheduler_output
):
scheduler_output = scheduler.step(noise_pred, t, latents)
latents_x0 = scheduler_output.pred_original_sample # Using the scheduler (Diffusers 0.4 and above)
# compute the previous noisy sample x_t -> x_t-1
latents = scheduler_output.prev_sample
from diffusion-nbs.
Hmm, I can't re-create. If it's failing at the last step you could stop a few steps early (if i == 45: break
) and you'll get to see the animation even if it isn't ideal.
Could you confirm that a fresh copy of the notebook fails here when you do 'Run all'?
from diffusion-nbs.
workaround
latents = latents.detach() - cond_grad * sigma**2
scheduler._step_index = scheduler._step_index - 1
or uncomment the manual stepping instead scheduler stepping
# Get the predicted x0:
latents_x0 = latents - sigma * noise_pred
# latents_x0 = scheduler.step(noise_pred, t, latents).pred_original_sample
from diffusion-nbs.
yeah getting the same error with index at UNET and CFG sections in the code to generate the video.. I tried reducing num_inference_steps to 45 but same error happens saying index 46 is out of bounds..
@venkyyuvy could you explain how exactly to use the first part of your workaround? I don't think cond_grad is defined in the code [nvm, found it in CFG section].. regarding the uncommenting part, I feel doing it through API (step) would be better than manually doing it like that right?
from diffusion-nbs.
Related Issues (14)
- typo in the last code section HOT 2
- Stable Diffusion deep dive notebook can't be run on 8GB GPUs HOT 5
- Perhaps bug in img2img example HOT 5
- How to get pred_original_sample when using PNDMScheduler HOT 1
- How to add clip loss in Guidence part for stable diffusion latent ? HOT 1
- Stable Diffusion deep dive notebook vae encoding problem HOT 2
- Broken hyperlinks for stable_diffusion.ipynb
- TypeError: __init__() got an unexpected keyword argument 'tensor_format' HOT 2
- Difference between `latents requires_grad=True` and `torch.no_grad()` HOT 2
- Deep Dive NB: Quick Fix for AttributeError: 'CLIPTextTransformer' object has no attribute '_build_causal_attention_mask' HOT 3
- FileNotFoundError: [Errno 2] No such file or directory: 'learned_embeds.bin' HOT 1
- crash
- Minor typo in Stable Diffusion Deep Dive notebook HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from diffusion-nbs.