mirror of
https://github.com/nomic-ai/gpt4all.git
synced 2024-10-01 01:06:10 -04:00
LLModel objects should hold a reference to the library
prevents llmodel lib from being gc'd before live model objects
This commit is contained in:
parent
1c4a244291
commit
c77ab849c0
@ -154,10 +154,11 @@ class LLModel:
|
|||||||
self.model = None
|
self.model = None
|
||||||
self.model_name = None
|
self.model_name = None
|
||||||
self.context = None
|
self.context = None
|
||||||
|
self.llmodel_lib = llmodel
|
||||||
|
|
||||||
def __del__(self):
|
def __del__(self):
|
||||||
if self.model is not None:
|
if self.model is not None:
|
||||||
llmodel.llmodel_model_destroy(self.model)
|
self.llmodel_lib.llmodel_model_destroy(self.model)
|
||||||
|
|
||||||
def memory_needed(self, model_path: str) -> int:
|
def memory_needed(self, model_path: str) -> int:
|
||||||
model_path_enc = model_path.encode("utf-8")
|
model_path_enc = model_path.encode("utf-8")
|
||||||
|
Loading…
Reference in New Issue
Block a user