Skip to content

Commit

Permalink
unload model
Browse files Browse the repository at this point in the history
  • Loading branch information
Tobias committed Feb 1, 2025
1 parent b5ae53f commit 241d456
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions llmware/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -10844,8 +10844,12 @@ def load_model(cls, model_name, sample=False, temperature=0.0, get_logits=True,

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

@classmethod
def check_if_model_loaded(cls, model_name):
Expand Down

0 comments on commit 241d456

Please sign in to comment.