Merge remote-tracking branch 'oldorigin/main'

This commit is contained in:
Alexey Dashko
2023-04-07 01:26:35 +03:00
3 changed files with 45 additions and 33 deletions

View File

@ -215,6 +215,7 @@
" ui1prefix = f\"{prefix} for UI 1: \"\n", " ui1prefix = f\"{prefix} for UI 1: \"\n",
" while True:\n", " while True:\n",
" line = p.stdout.readline().decode().strip()\n", " line = p.stdout.readline().decode().strip()\n",
" print(line)\n",
" if urlprefix in line:\n", " if urlprefix in line:\n",
" url = line.split(urlprefix)[1]\n", " url = line.split(urlprefix)[1]\n",
" break\n", " break\n",
@ -223,7 +224,6 @@
" break\n", " break\n",
" elif not line:\n", " elif not line:\n",
" break\n", " break\n",
" print(line)\n",
" if \"INIT\" in line and \"Transformers\" in line:\n", " if \"INIT\" in line and \"Transformers\" in line:\n",
" print(\"Model loading... (It will take 2 - 5 minutes)\")\n", " print(\"Model loading... (It will take 2 - 5 minutes)\")\n",
"\n", "\n",
@ -245,6 +245,7 @@
"\n", "\n",
"# ---\n", "# ---\n",
"# TavernAI extras\n", "# TavernAI extras\n",
"extras_url = '(disabled)'\n",
"params = []\n", "params = []\n",
"params.append('--cpu')\n", "params.append('--cpu')\n",
"ExtrasModules = []\n", "ExtrasModules = []\n",
@ -261,7 +262,6 @@
"params.append(f'--captioning-model={Captions_Model}')\n", "params.append(f'--captioning-model={Captions_Model}')\n",
"params.append(f'--enable-modules={\",\".join(ExtrasModules)}')\n", "params.append(f'--enable-modules={\",\".join(ExtrasModules)}')\n",
"\n", "\n",
"extras_url = '(disabled)'\n",
"\n", "\n",
"if UseExtrasExtensions:\n", "if UseExtrasExtensions:\n",
" def cloneExtras():\n", " def cloneExtras():\n",
@ -286,6 +286,7 @@
" %env googledrive=2\n", " %env googledrive=2\n",
"\n", "\n",
" def setupTavernPaths():\n", " def setupTavernPaths():\n",
" %cd /SillyTavern\n",
" tdrive = \"/content/drive/MyDrive/SillyTavern\"\n", " tdrive = \"/content/drive/MyDrive/SillyTavern\"\n",
" create_paths([\n", " create_paths([\n",
" tdrive,\n", " tdrive,\n",
@ -306,6 +307,7 @@
" ii.addTask(\"Setup Tavern Paths\", setupTavernPaths)\n", " ii.addTask(\"Setup Tavern Paths\", setupTavernPaths)\n",
"\n", "\n",
"def installTavernDependencies():\n", "def installTavernDependencies():\n",
" %cd /SillyTavern\n",
" !npm install\n", " !npm install\n",
" !npm install -g localtunnel\n", " !npm install -g localtunnel\n",
"ii.addTask(\"Install Tavern Dependencies\", installTavernDependencies)\n", "ii.addTask(\"Install Tavern Dependencies\", installTavernDependencies)\n",

View File

@ -1,9 +1,13 @@
import os, time, subprocess import os
import time
import subprocess
def runServer(): def runServer():
cmd = f"python server.py {' '.join(params)}" cmd = f"python server.py {' '.join(params)}"
print(cmd) print(cmd)
extras_process = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, cwd='/TavernAI-extras', shell=True) extras_process = subprocess.Popen(
cmd, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, cwd='/TavernAI-extras', shell=True)
print('processId:', extras_process.pid) print('processId:', extras_process.pid)
while True: while True:
line = extras_process.stdout.readline().decode().strip() line = extras_process.stdout.readline().decode().strip()
@ -14,10 +18,13 @@ def runServer():
break break
print(line) print(line)
def extractUrl():
subprocess.call('nohup lt --port 5100 > ./extras.out 2> ./extras.err &', shell=True)
print('Waiting for lt init...')
def extractUrl():
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: while True:
if (os.path.getsize('./extras.out') > 0): if (os.path.getsize('./extras.out') > 0):
with open('./extras.out', 'r') as f: with open('./extras.out', 'r') as f:
@ -32,4 +39,3 @@ def extractUrl():
with open('./extras.err', 'r') as f: with open('./extras.err', 'r') as f:
print(f.readlines()) print(f.readlines())
break break
time.sleep(1)

View File

@ -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? ### I want to try self-hosted easily. Got a Google Colab?
Try on Colab (runs KoboldAI backend and TavernAI Extras server alongside): <a target="_blank" href="https://colab.research.google.com/github/Cohee1207/TavernAI-extras/blob/main/colab/GPU.ipynb"> Try on Colab (runs KoboldAI backend and TavernAI Extras server alongside): <a target="_blank" href="https://colab.research.google.com/github/Cohee1207/SillyTavern/blob/main/colab/GPU.ipynb">
<img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/> <img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/>
</a> </a>
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 https://colab.research.google.com/github/Cohee1207/TavernAI-extras/blob/main/colab/GPU.ipynb
## Mobile support ## Mobile support