Open Daviljoe193 opened 1 year ago
As of commits 49f3a73 on @Camenduru's notebooks, and 65fe78e on @TheLastBen's notebooks, my workaround has been applied. This doesn't change that the workaround shouldn't be needed in the first place, but it means that those notebooks are no longer viable for recreating the issue. As of right now, @aadnk's OpenAI Whisper notebook still doesn't have the workaround, so it is still able to reproduce this issue.
Describe the current behavior Ever since early January (Colab being upgraded from Ubuntu 18.04 to 20.04), nearly every ML type notebook has been exibiting a strange behavior of not clearing system ram once no longer in use, specifically for Stable Diffusion and Whisper, which gets further compounded when switching models, eventuallly leading to no ram being usable, and the cell closing with a ^c. Below (Camenduru's Stable Diffusion notebook for Analog Diffusion, since it's all I have a screenrecording of, both pre and post 20.04 rollout) is a notebook showing this exact issue. Take note of the RAM indicator in the top right, that's NOT supposed to remain filled.
https://user-images.githubusercontent.com/67191631/218920053-1a4acf89-9e97-4f11-918d-8e998e8917d0.mp4
Describe the expected behavior The notebook should run like normal, and the system ram should be freed once it's no longer in use. Take note of the RAM indicator in the top right, that's what's SUPPOSED to happen.
https://user-images.githubusercontent.com/67191631/218919753-612ada2f-b6d9-4fe7-8c86-76dcd4d91b89.mp4
What web browser you are using Seems browser agnostic, though I've tested with Firefox, Microsoft Edge, and KDE's Falkon.
Additional context This issue seems to happen in nearly any notebook that uses the GPU. For me, the two pain points are @aadnk's notebook for OpenAI Whisper, and any Stable Diffusion notebook, doesn't matter if it's using Automatic1111's frontend via @Camenduru's notebook, or @TheLastBen's notebook, or even InvokeAI (Sorry, it's Russian, and needs an NGROK token). Every one of these has the same issue that wasn't present pre-20.04 rollout, ram gets used up, but then doesn't get freed until the cell stops. This issue has NOT been fixed, despite issue #3363 being closed, as mentioned by @remybonnav at the end of that thread...
https://github.com/googlecolab/colabtools/issues/3363#issuecomment-1424795538
And @Omenizer on this thread from TheLastBen's Github, relating to merging two or more models...
So far, the only workaround I've come up with requires rolling back a good few depends, in a pretty haphazard way. The below snippit can be run before everything else (Especially because of the dpkg with wildcard), and this makes things seem to work as they used to.