Skip to content

Commit 241d456

Browse files
author
Tobias
committed
unload model
1 parent b5ae53f commit 241d456

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

llmware/models.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10844,8 +10844,12 @@ def load_model(cls, model_name, sample=False, temperature=0.0, get_logits=True,
1084410844

1084510845
@classmethod
1084610846
def unload_model(cls, model_name):
10847-
""" Not implemented currently. """
10848-
return 0
10847+
if model_name in cls._ModelState.models_list:
10848+
# Remove the reference so Python can GC it
10849+
delattr(cls._ModelState, model_name)
10850+
cls._ModelState.models_list.remove(model_name)
10851+
cls._ModelState.models_loaded -= 1
10852+
logger.info(f"ModelResources - Unloaded model: {model_name}")
1084910853

1085010854
@classmethod
1085110855
def check_if_model_loaded(cls, model_name):

0 commit comments

Comments
 (0)