Skip to content
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

In exception handlers, clear the torch CUDA cache (if we're using CUD… #2549

Merged
merged 1 commit into from
Feb 6, 2023

Conversation

JPPhoto
Copy link
Contributor

@JPPhoto JPPhoto commented Feb 6, 2023

Clear the torch CUDA cache (if we're using CUDA) on exceptions to free up memory for other programs using the GPU and to reduce fragmentation.

…A) to free up memory for other programs using the GPU and to reduce fragmentation.
@JPPhoto JPPhoto enabled auto-merge (squash) February 6, 2023 13:19
Copy link
Collaborator

@lstein lstein left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems to work as expected. I control-C'd a few times during image generation and VRAM did not seem to grow.

@JPPhoto JPPhoto merged commit 2432adb into main Feb 6, 2023
@JPPhoto JPPhoto deleted the JPPhoto-exception-cache-clear branch February 6, 2023 15:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants