Skip to content

Commit

Permalink
Assistant destructor
Browse files Browse the repository at this point in the history
  • Loading branch information
artitw committed Oct 7, 2024
1 parent fcd9fcc commit c8e8094
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

setuptools.setup(
name="text2text",
version="1.7.0",
version="1.7.1",
author="artitw",
author_email="artitw@gmail.com",
description="Text2Text: Crosslingual NLP/G toolkit",
Expand Down
8 changes: 4 additions & 4 deletions text2text/assistant.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,13 +48,13 @@ def __init__(self, **kwargs):

def __del__(self):
ollama.delete(self.model_name)
self.ollama_serve_proc.kill()
if self.ollama_serve_proc:
self.ollama_serve_proc.kill()
self.ollama_serve_proc = None

def load_model(self):
if not ollama_version():
if self.ollama_serve_proc:
self.ollama_serve_proc.kill()
self.ollama_serve_proc = None
self.__del__(self)

return_code = os.system("sudo apt install -q -y lshw")
if return_code != 0:
Expand Down

0 comments on commit c8e8094

Please sign in to comment.