diff --git a/colab/GPU.ipynb b/colab/GPU.ipynb index 8c08c5958..de4d555b6 100644 --- a/colab/GPU.ipynb +++ b/colab/GPU.ipynb @@ -215,6 +215,7 @@ " ui1prefix = f\"{prefix} for UI 1: \"\n", " while True:\n", " line = p.stdout.readline().decode().strip()\n", + " print(line)\n", " if urlprefix in line:\n", " url = line.split(urlprefix)[1]\n", " break\n", @@ -223,7 +224,6 @@ " break\n", " elif not line:\n", " break\n", - " print(line)\n", " if \"INIT\" in line and \"Transformers\" in line:\n", " print(\"Model loading... (It will take 2 - 5 minutes)\")\n", "\n", @@ -245,6 +245,7 @@ "\n", "# ---\n", "# TavernAI extras\n", + "extras_url = '(disabled)'\n", "params = []\n", "params.append('--cpu')\n", "ExtrasModules = []\n", @@ -261,7 +262,6 @@ "params.append(f'--captioning-model={Captions_Model}')\n", "params.append(f'--enable-modules={\",\".join(ExtrasModules)}')\n", "\n", - "extras_url = '(disabled)'\n", "\n", "if UseExtrasExtensions:\n", " def cloneExtras():\n", @@ -286,6 +286,7 @@ " %env googledrive=2\n", "\n", " def setupTavernPaths():\n", + " %cd /SillyTavern\n", " tdrive = \"/content/drive/MyDrive/SillyTavern\"\n", " create_paths([\n", " tdrive,\n", @@ -306,6 +307,7 @@ " ii.addTask(\"Setup Tavern Paths\", setupTavernPaths)\n", "\n", "def installTavernDependencies():\n", + " %cd /SillyTavern\n", " !npm install\n", " !npm install -g localtunnel\n", "ii.addTask(\"Install Tavern Dependencies\", installTavernDependencies)\n", diff --git a/colab/extras_server.py b/colab/extras_server.py index 023075e89..6c258b68d 100644 --- a/colab/extras_server.py +++ b/colab/extras_server.py @@ -1,35 +1,41 @@ -import os, time, subprocess +import os +import time +import subprocess + def runServer(): - cmd = f"python server.py {' '.join(params)}" - print(cmd) - extras_process = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, cwd='/TavernAI-extras', shell=True) - print('processId:', extras_process.pid) - while True: - line = extras_process.stdout.readline().decode().strip() - if "Running on " in line: - break - if not line: - print('breaking on line') - break - print(line) + cmd = f"python server.py {' '.join(params)}" + print(cmd) + extras_process = subprocess.Popen( + cmd, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, cwd='/TavernAI-extras', shell=True) + print('processId:', extras_process.pid) + while True: + line = extras_process.stdout.readline().decode().strip() + if "Running on " in line: + break + if not line: + print('breaking on line') + break + print(line) + def extractUrl(): - subprocess.call('nohup lt --port 5100 > ./extras.out 2> ./extras.err &', shell=True) - print('Waiting for lt init...') - - while True: - if (os.path.getsize('./extras.out') > 0): - with open('./extras.out', 'r') as f: - lines = f.readlines() - for x in range(len(lines)): - if ('your url is: ' in lines[x]): - print('TavernAI Extensions URL:') - extras_url = lines[x].split('your url is: ')[1] - print(extras_url) + global extras_url + subprocess.call( + 'nohup lt --port 5100 > ./extras.out 2> ./extras.err &', shell=True) + print('Waiting for lt init...') + time.sleep(5) + while True: + if (os.path.getsize('./extras.out') > 0): + with open('./extras.out', 'r') as f: + lines = f.readlines() + for x in range(len(lines)): + if ('your url is: ' in lines[x]): + print('TavernAI Extensions URL:') + extras_url = lines[x].split('your url is: ')[1] + print(extras_url) + break + if (os.path.getsize('./extras.err') > 0): + with open('./extras.err', 'r') as f: + print(f.readlines()) break - if (os.path.getsize('./extras.err') > 0): - with open('./extras.err', 'r') as f: - print(f.readlines()) - break - time.sleep(1) \ No newline at end of file diff --git a/readme.md b/readme.md index 7c686bbb1..7c05f346b 100644 --- a/readme.md +++ b/readme.md @@ -19,10 +19,14 @@ Since Tavern is only a user interface, it has tiny hardware requirements, it wil ### I want to try self-hosted easily. Got a Google Colab? -Try on Colab (runs KoboldAI backend and TavernAI Extras server alongside): +Try on Colab (runs KoboldAI backend and TavernAI Extras server alongside): Open In Colab +https://colab.research.google.com/github/Cohee1207/SillyTavern/blob/main/colab/GPU.ipynb + +If that didn't work, try the legacy link: + https://colab.research.google.com/github/Cohee1207/TavernAI-extras/blob/main/colab/GPU.ipynb ## Mobile support