-
Notifications
You must be signed in to change notification settings - Fork 6k
Using lpw_stable_diffusion with sequential_cpu_offload gives 'NotImplementedError: Cannot copy out of meta tensor; no data!' #2531
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
Comments
|
in case it is relevant due to #2500 |
Hey @d1g1t, pipe.enable_sequential_cpu_offload() is not (yet) implemented for the lpw pipeline. The method needs to be added directly to: |
Ah, Looks like |
I too kept running into this error a couple months ago trying to enable cpu offload, but thought it was some other thing I was doing wrong, not just the lpw pipeline which has been my primary. I instead disabled the option for offloading everywhere and gave up enabling it. I hope it's easy to implement it into LPW Pipeline and any of the other pipes that are missing it, that'd make a difference for us... Every bit helps for the low vram... |
I'm not fluent with the code base, but the errors seem to be happening due to a few tensors being created on the meta device in I've got both On my 1060 card with 6GB VRAM, |
I applied your hacks to my lpw, plus the empty_cache() part that Patrick just added, and so far so good with sequential_cpu_offload enabled, not getting that meta tensor error anymore. Still testing, but the the memory was much lower. I'm wondering if it's also safe to add enable_vae_slicing and enable_vae_tiling into lpw since it's just calls self.vae function... |
I suspect they don't need to be added because |
Looks like you also cannot pass a list of generators as shown in https://huggingface.co/docs/diffusers/using-diffusers/reusing_seeds
The Previously, I had been passing latents as shown in This Collab (I think this used to be linked in the docs) until now and was getting inconsistent images with the same seed, but only when using Euler Ancestral and KDPM2 Ancestral Schedulers. |
In case anyone ends up on this page, I ended up with a much simpler way to use lpw that I've posted at #2668 (comment) which is to simply generate the embeddings using a method in the lpw file instead of using it as a custom pipeline, and passing those to the pipeline instead. |
This issue has been automatically marked as stale because it has not had recent activity. If you think this still needs to be addressed please comment on this thread. Please note that issues that do not follow the contributing guidelines are likely to be ignored. |
Describe the bug
Trying to use the example code from https://huggingface.co/docs/diffusers/using-diffusers/custom_pipeline_examples
with cpu offloading as suggested at https://huggingface.co/docs/diffusers/optimization/fp16#offloading-to-cpu-with-accelerate-for-memory-savings
I have removed the
pipe.to("cuda")
as suggested.Reproduction
Logs
No response
System Info
The text was updated successfully, but these errors were encountered: