From a2fdea3bb265afe800eed40bc8c0a295841192a6 Mon Sep 17 00:00:00 2001 From: Alexey Dashko Date: Thu, 6 Apr 2023 13:34:34 +0300 Subject: [PATCH 1/4] TLDR beforehand is_colab check port through SILLY_TAVERN_PORT env fix typo on autorun open --- server.js | 18 +++++------------- 1 file changed, 5 insertions(+), 13 deletions(-) diff --git a/server.js b/server.js index a75767a88..77adc2f0f 100644 --- a/server.js +++ b/server.js @@ -22,7 +22,7 @@ const crypto = require('crypto'); const ipaddr = require('ipaddr.js'); const config = require(path.join(process.cwd(), './config.conf')); -const server_port = config.port; +const server_port = process.env.SILLY_TAVERN_PORT || config.port; const whitelist = config.whitelist; const whitelistMode = config.whitelistMode; const autorun = config.autorun; @@ -81,7 +81,7 @@ function humanizedISO8601DateTime() { return HumanizedDateTime; }; -var is_colab = false; +var is_colab = process.env.colab !== undefined; var charactersPath = 'public/characters/'; var chatsPath = 'public/chats/'; if (is_colab && process.env.googledrive == 2) { @@ -732,16 +732,13 @@ app.post("/getcharacters", jsonParser, function (request, response) { }); app.post("/getbackgrounds", jsonParser, function (request, response) { var images = getImages("public/backgrounds"); - if (is_colab === true) { - images = ['tavern.png']; - } response.send(JSON.stringify(images)); }); app.post("/iscolab", jsonParser, function (request, response) { let send_data = false; - if (process.env.colaburl !== undefined) { - send_data = String(process.env.colaburl).trim(); + if (is_colab) { + send_data = String(process.env.colaburl).trim(); } response.send({ colaburl: send_data }); @@ -1908,15 +1905,10 @@ function getAsync(url, args) { // ** END ** app.listen(server_port, (listen ? '0.0.0.0' : '127.0.0.1'), async function () { - if (process.env.colab !== undefined) { - if (process.env.colab == 2) { - is_colab = true; - } - } ensurePublicDirectoriesExist(); await ensureThumbnailCache(); console.log('Launching...'); - if (autorun) open('http:127.0.0.1:' + server_port); + if (autorun) open('http://127.0.0.1:' + server_port); console.log('TavernAI started: http://127.0.0.1:' + server_port); if (fs.existsSync('public/characters/update.txt') && !is_colab) { convertStage1(); From eab26b2d7ecc049fae9cd0d48baddcfbd9a7eb1f Mon Sep 17 00:00:00 2001 From: Alexey Dashko Date: Thu, 6 Apr 2023 16:50:54 +0300 Subject: [PATCH 2/4] check colab by colaburl --- server.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/server.js b/server.js index 77adc2f0f..c18a7a2c1 100644 --- a/server.js +++ b/server.js @@ -81,7 +81,7 @@ function humanizedISO8601DateTime() { return HumanizedDateTime; }; -var is_colab = process.env.colab !== undefined; +var is_colab = process.env.colaburl !== undefined; var charactersPath = 'public/characters/'; var chatsPath = 'public/chats/'; if (is_colab && process.env.googledrive == 2) { From 6ca5a4820b14cfc423b5a9f7f433aebcdd2c5900 Mon Sep 17 00:00:00 2001 From: Alexey Dashko Date: Thu, 6 Apr 2023 17:04:52 +0300 Subject: [PATCH 3/4] only symlink dirs no unconsistent paths --- server.js | 4 ---- 1 file changed, 4 deletions(-) diff --git a/server.js b/server.js index c18a7a2c1..df5a2d6be 100644 --- a/server.js +++ b/server.js @@ -84,10 +84,6 @@ function humanizedISO8601DateTime() { var is_colab = process.env.colaburl !== undefined; var charactersPath = 'public/characters/'; var chatsPath = 'public/chats/'; -if (is_colab && process.env.googledrive == 2) { - charactersPath = '/content/drive/MyDrive/TavernAI/characters/'; - chatsPath = '/content/drive/MyDrive/TavernAI/chats/'; -} const jsonParser = express.json({ limit: '100mb' }); const urlencodedParser = express.urlencoded({ extended: true, limit: '100mb' }); const baseRequestArgs = { headers: { "Content-Type": "application/json" } }; From 4384578b348d285a8686db27ccab382f5a34ed74 Mon Sep 17 00:00:00 2001 From: Alexey Dashko Date: Thu, 6 Apr 2023 20:28:27 +0300 Subject: [PATCH 4/4] tiny colab barely tested on option combinations should work perfectly for first startup with default options has step caching and more stock models thanks to OTIS colab has cell for converting TavernAI webm to SillyTavern png --- colab/GPU.ipynb | 494 +++++++++++++++++++++++++++++------------------- 1 file changed, 304 insertions(+), 190 deletions(-) diff --git a/colab/GPU.ipynb b/colab/GPU.ipynb index c1474e479..331cd77a3 100644 --- a/colab/GPU.ipynb +++ b/colab/GPU.ipynb @@ -1,195 +1,11 @@ { - "cells": [ - { - "cell_type": "markdown", - "metadata": { - "id": "d-Yihz3hAb2E" - }, - "source": [ - "https://colab.research.google.com/github/TavernAI/TavernAI/blob/main/colab/GPU.ipynb
\n", - "\n", - "Works with:
\n", - "KoboldAI https://github.com/KoboldAI/KoboldAI-Client
\n", - "Pygmalion https://huggingface.co/PygmalionAI/
\n", - "
\n", - "**Links**
\n", - "TavernAI Github https://github.com/TavernAI/TavernAI
\n", - "TavernAI Discord https://discord.gg/zmK2gmr45t
\n", - "TavernAI Boosty https://boosty.to/tavernai\n", - "
\n",
-        " Tavern.AI/ \\ /  ^   ^ ^ ^    ~~~~ ^ \\     /  ^ ^   ^ ^/ ^  ^ \\/^  ^    \\\n",
-        "         /^ ^\\ ^  ^ ^   ^ ^  ~~   ^   \\   /  ^  ^ ^   / ^ ^  ^/   ^ ^    \\\n",
-        "        /^ ^ ^\\^   ^ ^ ^   _||____   ^ \\ /  ^  ^ ^   /       /  ^  ^  ^   \\\n",
-        " /\\ /\\ /\\   ^  \\  /\\ /\\   /\\\\\\\\\\\\\\\\   ^ \\  ^ /\\ /\\ /\\   /\\ /\\ /\\  ^ ^  ^/\\\n",
-        "//\\\\/\\\\/\\\\   ^  \\//\\\\/\\\\ /__\\\\\\\\\\\\\\\\  _, \\  //\\\\/\\\\/\\\\ //\\\\/\\\\/\\\\  ^ ^ //\\\\\n",
-        "//\\\\/\\\\/\\\\       //\\\\/\\\\ |__|_|_|__|   \\__, //\\\\/\\\\/\\\\ //\\\\/\\\\/\\\\     ///\\\\\\\n",
-        " || || (@^◡^)(≖ ‸ ≖*) ( ←_← )\\| /|   /\\ \\ヽ(°ㅂ°╬) |( Ψ▼ー▼)∈ (O_O; )  |||\n",
-        "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~ ~~~~~ ~~~~~ ~~~~~  ~~~~~ ~~ \n",
-        "
\n", - "**Launch Instructions**
\n", - "1. Click the launch button.\n", - "2. Wait for the environment and model to load\n", - "3. After initialization, a TavernAI link will appear\n", - "\n", - "**Faq**
\n", - "* Q: I do not get a TavernAI link\n", - "* A: It seems the localtunnel service is currently down, so the TavernAI link is unavailable. Need to wait for it to start working again." - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": { - "id": "hCpoIHxYcDGs" - }, - "outputs": [], - "source": [ - "#@title <-- Tap this if you play on Mobile { display-mode: \"form\" }\n", - "#Taken from KoboldAI colab\n", - "%%html\n", - "Press play on the music player to keep the tab alive, then start TavernAI below (Uses only 13MB of data)
\n", - "