Skip to content

Commit 0570d3e

Browse files
committed
Fix Assistant
1 parent ce160df commit 0570d3e

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

setup.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
setuptools.setup(
77
name="text2text",
8-
version="1.6.7",
8+
version="1.6.8",
99
author="artitw",
1010
author_email="artitw@gmail.com",
1111
description="Text2Text: Crosslingual NLP/G toolkit",

text2text/assistant.py

+4-1
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ def load_model(self):
6363
result = os.system(
6464
"curl -fsSL https://ollama.com/install.sh | sh"
6565
)
66-
if result!=0:
66+
if result != 0:
6767
raise Exception("Cannot install ollama")
6868

6969
self.ollama_serve_proc = subprocess.Popen(["ollama", "serve"])
@@ -79,13 +79,16 @@ def load_model(self):
7979
result = ollama.pull(self.model_name)
8080
if result["status"] != "success":
8181
raise Exception(f"Did not pull {self.model_name}.")
82+
83+
ollama_run_proc = subprocess.Popen(["ollama", "run", self.model_name])
8284

8385
def chat_completion(self, messages=[{"role": "user", "content": "hello"}], stream=False, schema=None, **kwargs):
8486
try:
8587
result = ollama.ps()
8688
if not result or not result.get("models"):
8789
result = ollama.pull(self.model_name)
8890
if result["status"] == "success":
91+
ollama_run_proc = subprocess.Popen(["ollama", "run", self.model_name])
8992
return self.chat_completion(messages=messages, stream=stream, **kwargs)
9093
raise Exception(f"Did not pull {self.model_name}. Try restarting.")
9194
except Exception as e:

0 commit comments

Comments
 (0)