Model: Fix state flag sets on unload

The load state should be false only if the models are unloaded.

Signed-off-by: kingbri <bdashore3@proton.me>
This commit is contained in:
kingbri 2024-03-11 23:42:52 -04:00 committed by Brian Dashore
parent 894be4a818
commit 8b46282aef

View file

@ -475,11 +475,13 @@ class ExllamaV2Container:
self.tokenizer = None
self.generator = None
# Set all model state variables to False
self.model_is_loading = False
self.model_loaded = False
gc.collect()
torch.cuda.empty_cache()
# Update model load state
self.model_loaded = False
logger.info("Loras unloaded." if loras_only else "Model unloaded.")
def encode_tokens(self, text: str, **kwargs):