Skip to content

Commit

Permalink
Fix Assistant
Browse files Browse the repository at this point in the history
  • Loading branch information
artitw committed Oct 7, 2024
1 parent 061c332 commit 9a544ff
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 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.6.2",
version="1.6.3",
author="artitw",
author_email="artitw@gmail.com",
description="Text2Text: Crosslingual NLP/G toolkit",
Expand Down
14 changes: 8 additions & 6 deletions text2text/assistant.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
import warnings
import importlib.resources

from . import utils

from llama_index.llms.ollama import Ollama
from llama_index.core.llms import ChatMessage

Expand Down Expand Up @@ -62,12 +64,12 @@ def load_model(self):
if return_code != 0:
raise Exception("Cannot install lshw.")

resource_path = 'ollama_install.sh'
with importlib.resources.open_text('text2text.utils', resource_path) as f:
install_script = f.read()
result = run_sh(install_script)
if "Install complete." not in result and "will run in CPU-only mode." not in result:
raise Exception(result)
inp_file = importlib.resources.files(utils) / 'ollama_install.sh'
with inp_file.open("rt") as f:
install_script = f.read()
result = run_sh(install_script)
if "Install complete." not in result and "will run in CPU-only mode." not in result:
raise Exception(result)

self.ollama_serve_proc = subprocess.Popen(["ollama", "serve"])
time.sleep(1)
Expand Down

0 comments on commit 9a544ff

Please sign in to comment.