-
Notifications
You must be signed in to change notification settings - Fork 48
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
Possibly GPU memory leak? #24
Comments
hmm, compel is basically stateless, there isn't much that could leak that i have much control over. torch is sometimes poor at cleaning up its caches properly, you might want to try calling |
Thanks. I think I have pushed VRAM usage on edge -- maybe torch need some extra room to maneuver... (Updated Apr. 17) OOM occurs even if just prompt embeddings were built repeatedly w/o running inference (i.e., |
urgh. idk. i also don't have a local gpu to readily debug this. have you tried tearing down the compel instance and making a new one for each prompt? |
Interesting. I run the same test on Google Colab (GPU w/ 12G VRAM) and no OOM issue occured. Then I updated my local envrionment with exact same package versions (e.g., torch, diffusers, compel, ... etc) like the Colab however OOM issue still occurs. Local test was on Nvidia GPU with 4G and 8G, btw. init & delete compel instance inside the loop doesn't help, fyi |
@kshieh1 Did you ever figure out a solution to this? I'm also hitting my 6GB limit as soon as I use the compel embeddings |
No luck so far |
I think I have come out a solution. After image generation, you should explictly de-reference the tensor object (i.e., |
ahh nice. i'll add a note on the readme for the next version. thanks for sharing your solution! |
The readme has been updated. |
@kshieh1 we encountered a possibly related (possibly the same?) problem in InvokeAI, which was resolved by doing calls to Compel inside a |
Yeah, I just did a quick test and found the amount of cuda memory allocation is stable -- I think I can get rid of those costly gc.collect() operations from my code. Thanks for sharing. |
Hi,
Found a GPU out-of-memory(OOM) error when using comple in my project. I made a shorter test program out of your
compel-demp.py
:Tested on Nvidia RTX-3050Ti Mobile GPU w/ 4G VRAM, an OOM exception will occur after 10~20 iterations. No OOM if use
COMPEL = False
.The text was updated successfully, but these errors were encountered: