Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
C
coderai
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexlab
coderai
Commits
ba4ce29f
Commit
ba4ce29f
authored
Mar 17, 2026
by
Your Name
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add cleanup method to MultiModelManager
parent
de9a6cdc
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
25 additions
and
0 deletions
+25
-0
manager.py
codai/models/manager.py
+25
-0
No files found.
codai/models/manager.py
View file @
ba4ce29f
...
@@ -398,6 +398,31 @@ class MultiModelManager:
...
@@ -398,6 +398,31 @@ class MultiModelManager:
"""Return the first image model or None."""
"""Return the first image model or None."""
return
self
.
image_models
[
0
]
if
self
.
image_models
else
None
return
self
.
image_models
[
0
]
if
self
.
image_models
else
None
def
cleanup
(
self
):
"""Cleanup all models and resources."""
# Cleanup all model managers
for
key
,
manager
in
self
.
models
.
items
():
try
:
if
hasattr
(
manager
,
'cleanup'
):
manager
.
cleanup
()
except
Exception
as
e
:
print
(
f
"Warning: Error cleaning up model {key}: {e}"
)
self
.
models
.
clear
()
# Cleanup whisper server
if
self
.
whisper_server
:
try
:
self
.
whisper_server
.
stop
()
except
Exception
as
e
:
print
(
f
"Warning: Error cleaning up whisper server: {e}"
)
# Clear all model lists
self
.
default_model
=
None
self
.
audio_models
.
clear
()
self
.
image_models
.
clear
()
self
.
vision_models
.
clear
()
self
.
tts_model
=
None
def
_aggressive_vram_cleanup
(
self
,
model_manager
):
def
_aggressive_vram_cleanup
(
self
,
model_manager
):
"""Aggressively cleanup VRAM when switching between different model types."""
"""Aggressively cleanup VRAM when switching between different model types."""
try
:
try
:
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment