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

Add VRAM flush when idle #255

Closed
wants to merge 1 commit into from

Conversation

AngelOnFira
Copy link

@AngelOnFira AngelOnFira commented Dec 9, 2024

Still working on testing this

Implement automatic VRAM clearing after a specified period of idleness.

* Add a mechanism to track the last activity time and implement a background thread to monitor idleness and clear VRAM after five minutes of inactivity in `app/faster_whisper/core.py` and `app/openai_whisper/core.py`.
* Update the `transcribe` and `language_detection` functions in both core files to reset the last activity time upon invocation.
* Add a function to fully release the model from memory using `del`, `torch.cuda.empty_cache()`, and `gc.collect()` in both core files.
* Add configuration options for the idleness timeout period and enabled/disabled state in the environment variables in `app/webservice.py`.
@AngelOnFira
Copy link
Author

Closing in favour of #256

@AngelOnFira AngelOnFira closed this Dec 9, 2024
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.

1 participant