Fooocus icon indicating copy to clipboard operation
Fooocus copied to clipboard

Can I release the GPU manually?

Open EvilBT opened this issue 2 years ago • 1 comments

Can you provide an interface or button to release all the memory cached on the GPU? I want to use another AI software at the same time, but I don’t want to restart Fooocus.

EvilBT avatar Dec 09 '23 20:12 EvilBT

Also needed this, surprised there's no way to do it... Here's what I did, all in webui.py:

line 397, add the unload_model button:

                with gr.Row():
                    refresh_files = gr.Button(label='Refresh', value='\U0001f504 Refresh All Files', variant='secondary', elem_classes='refresh_button')
                    unload_model = gr.Button(label='Unload', value='Unload model', variant='secondary')

line 586, add the handler for it:

                def unload_model_clicked():
                    import ldm_patched.modules.model_management as model_management
                    model_management.unload_all_models()

                unload_model.click(unload_model_clicked)

Now under the advanced->model tab, you can unload models :)

ppil avatar Jun 21 '24 03:06 ppil