Colab file fix

This commit is contained in:
Ash
2023-02-02 02:02:15 +04:00
parent d37d624b76
commit b535250428

View File

@@ -1,161 +1,191 @@
#@title <b><-- Run</b> {
#@markdown Models "nbformat": 4,
"nbformat_minor": 0,
Model = "Pygmalion 6B" #@param ["Nerys V2 6B", "Erebus 6B", "Skein 6B", "Janeway 6B", "Adventure 6B", "Pygmalion 6B", "Pygmalion 6B Dev", "Lit V2 6B", "Lit 6B", "Shinen 6B", "Nerys 2.7B", "AID 2.7B", "Erebus 2.7B", "Janeway 2.7B", "Picard 2.7B", "Horni LN 2.7B", "Horni 2.7B", "Shinen 2.7B", "OPT 2.7B", "Fairseq Dense 2.7B", "Neo 2.7B"] {allow-input: true} "metadata": {
Version = "Official" #@param ["Official", "United"] {allow-input: true} "colab": {
Provider = "Cloudflare" #@param ["Localtunnel", "Cloudflare"] "provenance": []
use_google_drive = False #@param {type:"boolean"} },
"kernelspec": {
!nvidia-smi "name": "python3",
import subprocess "display_name": "Python 3"
import time },
import sys "language_info": {
import os "name": "python"
from google.colab import drive },
if use_google_drive: "accelerator": "GPU",
drive.mount('/content/drive/') "gpuClass": "standard"
else: },
if not os.path.exists("/content/drive"): "cells": [
os.mkdir("/content/drive") {
if not os.path.exists("/content/drive/MyDrive/"): "cell_type": "code",
os.mkdir("/content/drive/MyDrive/") "execution_count": null,
"metadata": {
Revision = "" "id": "hps3qtPLFNBb"
},
if Model == "Nerys V2 6B": "outputs": [],
Model = "KoboldAI/OPT-6B-nerys-v2" "source": [
path = "" "#@title <b><-- Select your model below and then click this to start KoboldAI</b>\n",
download = "" "#@markdown You can find a description of the models below along with instructions on how to start KoboldAI.\n",
elif Model == "Erebus 6B": "\n",
Model = "KoboldAI/OPT-6.7B-Erebus" "Model = \"Pygmalion 6B\" #@param [\"Nerys V2 6B\", \"Erebus 6B\", \"Skein 6B\", \"Janeway 6B\", \"Adventure 6B\", \"Pygmalion 6B\", \"Pygmalion 6B Dev\", \"Lit V2 6B\", \"Lit 6B\", \"Shinen 6B\", \"Nerys 2.7B\", \"AID 2.7B\", \"Erebus 2.7B\", \"Janeway 2.7B\", \"Picard 2.7B\", \"Horni LN 2.7B\", \"Horni 2.7B\", \"Shinen 2.7B\", \"OPT 2.7B\", \"Fairseq Dense 2.7B\", \"Neo 2.7B\"] {allow-input: true}\n",
path = "" "Version = \"Official\" #@param [\"Official\", \"United\"] {allow-input: true}\n",
download = "" "Provider = \"Cloudflare\" #@param [\"Localtunnel\", \"Cloudflare\"]\n",
elif Model == "Skein 6B": "use_google_drive = False #@param {type:\"boolean\"}\n",
Model = "KoboldAI/GPT-J-6B-Skein" "\n",
path = "" "!nvidia-smi\n",
download = "" "import subprocess\n",
elif Model == "Janeway 6B": "import time\n",
Model = "KoboldAI/GPT-J-6B-Janeway" "import sys\n",
path = "" "import os\n",
download = "" "from google.colab import drive\n",
elif Model == "Adventure 6B": "if use_google_drive:\n",
Model = "KoboldAI/GPT-J-6B-Adventure" " drive.mount('/content/drive/')\n",
path = "" "else:\n",
download = "" " if not os.path.exists(\"/content/drive\"):\n",
elif Model == "Pygmalion 6B": " os.mkdir(\"/content/drive\")\n",
Model = "PygmalionAI/pygmalion-6b" " if not os.path.exists(\"/content/drive/MyDrive/\"):\n",
path = "" " os.mkdir(\"/content/drive/MyDrive/\")\n",
download = "" "\n",
Version = "United" "Revision = \"\"\n",
elif Model == "Pygmalion 6B Dev": "\n",
Model = "PygmalionAI/pygmalion-6b" "if Model == \"Nerys V2 6B\":\n",
Revision = "--revision dev" " Model = \"KoboldAI/OPT-6B-nerys-v2\"\n",
path = "" " path = \"\"\n",
Version = "United" " download = \"\"\n",
download = "" "elif Model == \"Erebus 6B\":\n",
elif Model == "Lit V2 6B": " Model = \"KoboldAI/OPT-6.7B-Erebus\"\n",
Model = "hakurei/litv2-6B-rev3" " path = \"\"\n",
path = "" " download = \"\"\n",
download = "" "elif Model == \"Skein 6B\":\n",
elif Model == "Lit 6B": " Model = \"KoboldAI/GPT-J-6B-Skein\"\n",
Model = "hakurei/lit-6B" " path = \"\"\n",
path = "" " download = \"\"\n",
download = "" "elif Model == \"Janeway 6B\":\n",
elif Model == "Shinen 6B": " Model = \"KoboldAI/GPT-J-6B-Janeway\"\n",
Model = "KoboldAI/GPT-J-6B-Shinen" " path = \"\"\n",
path = "" " download = \"\"\n",
download = "" "elif Model == \"Adventure 6B\":\n",
elif Model == "Nerys 2.7B": " Model = \"KoboldAI/GPT-J-6B-Adventure\"\n",
Model = "KoboldAI/fairseq-dense-2.7B-Nerys" " path = \"\"\n",
path = "" " download = \"\"\n",
download = "" "elif Model == \"Pygmalion 6B\":\n",
elif Model == "Erebus 2.7B": " Model = \"PygmalionAI/pygmalion-6b\"\n",
Model = "KoboldAI/OPT-2.7B-Erebus" " path = \"\"\n",
path = "" " download = \"\"\n",
download = "" " Version = \"United\"\n",
elif Model == "Janeway 2.7B": "elif Model == \"Pygmalion 6B Dev\":\n",
Model = "KoboldAI/GPT-Neo-2.7B-Janeway" " Model = \"PygmalionAI/pygmalion-6b\"\n",
path = "" " Revision = \"--revision dev\"\n",
download = "" " path = \"\"\n",
elif Model == "Picard 2.7B": " Version = \"United\"\n",
Model = "KoboldAI/GPT-Neo-2.7B-Picard" " download = \"\"\n",
path = "" "elif Model == \"Lit V2 6B\":\n",
download = "" " Model = \"hakurei/litv2-6B-rev3\"\n",
elif Model == "AID 2.7B": " path = \"\"\n",
Model = "KoboldAI/GPT-Neo-2.7B-AID" " download = \"\"\n",
path = "" "elif Model == \"Lit 6B\":\n",
download = "" " Model = \"hakurei/lit-6B\"\n",
elif Model == "Horni LN 2.7B": " path = \"\"\n",
Model = "KoboldAI/GPT-Neo-2.7B-Horni-LN" " download = \"\"\n",
path = "" "elif Model == \"Shinen 6B\":\n",
download = "" " Model = \"KoboldAI/GPT-J-6B-Shinen\"\n",
elif Model == "Horni 2.7B": " path = \"\"\n",
Model = "KoboldAI/GPT-Neo-2.7B-Horni" " download = \"\"\n",
path = "" "elif Model == \"Nerys 2.7B\":\n",
download = "" " Model = \"KoboldAI/fairseq-dense-2.7B-Nerys\"\n",
elif Model == "Shinen 2.7B": " path = \"\"\n",
Model = "KoboldAI/GPT-Neo-2.7B-Shinen" " download = \"\"\n",
path = "" "elif Model == \"Erebus 2.7B\":\n",
download = "" " Model = \"KoboldAI/OPT-2.7B-Erebus\"\n",
elif Model == "Fairseq Dense 2.7B": " path = \"\"\n",
Model = "KoboldAI/fairseq-dense-2.7B" " download = \"\"\n",
path = "" "elif Model == \"Janeway 2.7B\":\n",
download = "" " Model = \"KoboldAI/GPT-Neo-2.7B-Janeway\"\n",
elif Model == "OPT 2.7B": " path = \"\"\n",
Model = "facebook/opt-2.7b" " download = \"\"\n",
path = "" "elif Model == \"Picard 2.7B\":\n",
download = "" " Model = \"KoboldAI/GPT-Neo-2.7B-Picard\"\n",
elif Model == "Neo 2.7B": " path = \"\"\n",
Model = "EleutherAI/gpt-neo-2.7B" " download = \"\"\n",
path = "" "elif Model == \"AID 2.7B\":\n",
download = "" " Model = \"KoboldAI/GPT-Neo-2.7B-AID\"\n",
" path = \"\"\n",
if Provider == "Localtunnel": " download = \"\"\n",
tunnel = "--localtunnel yes" "elif Model == \"Horni LN 2.7B\":\n",
else: " Model = \"KoboldAI/GPT-Neo-2.7B-Horni-LN\"\n",
tunnel = "" " path = \"\"\n",
" download = \"\"\n",
#Henk's KoboldAI script "elif Model == \"Horni 2.7B\":\n",
!wget https://koboldai.org/ckds && chmod +x ckds " Model = \"KoboldAI/GPT-Neo-2.7B-Horni\"\n",
!./ckds --init only " path = \"\"\n",
p = subprocess.Popen(['/content/ckds', '--model', Model], stdout=subprocess.PIPE, stderr=subprocess.PIPE) " download = \"\"\n",
"elif Model == \"Shinen 2.7B\":\n",
#Tricks " Model = \"KoboldAI/GPT-Neo-2.7B-Shinen\"\n",
url = '' " path = \"\"\n",
while True: " download = \"\"\n",
line = p.stdout.readline().decode().strip() "elif Model == \"Fairseq Dense 2.7B\":\n",
if "KoboldAI has finished loading and is available at the following link: " in line: " Model = \"KoboldAI/fairseq-dense-2.7B\"\n",
print(line) " path = \"\"\n",
url = line.split("KoboldAI has finished loading and is available at the following link: ")[1] " download = \"\"\n",
print(url) "elif Model == \"OPT 2.7B\":\n",
break " Model = \"facebook/opt-2.7b\"\n",
if "KoboldAI has finished loading and is available at the following link for UI 1: " in line: " path = \"\"\n",
print(line) " download = \"\"\n",
url = line.split("KoboldAI has finished loading and is available at the following link for UI 1: ")[1] "elif Model == \"Neo 2.7B\":\n",
print(url) " Model = \"EleutherAI/gpt-neo-2.7B\"\n",
break " path = \"\"\n",
if not line: " download = \"\"\n",
break "\n",
print(line) "if Provider == \"Localtunnel\":\n",
if "INIT" in line and "Transformers" in line: " tunnel = \"--localtunnel yes\"\n",
print("Model loading... (It will take 2 - 5 minutes)") "else:\n",
" tunnel = \"\"\n",
#TavernAI "\n",
%cd / "#Henk's KoboldAI script\n",
!curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.37.2/install.sh | bash "!wget https://koboldai.org/ckds && chmod +x ckds\n",
!nvm install 19.1.0 "!./ckds --init only\n",
!nvm use 19.1.0 "p = subprocess.Popen(['/content/ckds', '--model', Model], stdout=subprocess.PIPE, stderr=subprocess.PIPE)\n",
!node -v "\n",
!git clone https://github.com/TavernAI/TavernAI.git "#Tricks\n",
%cd TavernAI "url = ''\n",
!npm install "while True:\n",
time.sleep(1) " line = p.stdout.readline().decode().strip()\n",
%env colab=2 " if \"KoboldAI has finished loading and is available at the following link: \" in line:\n",
%env colaburl=$url " print(line)\n",
!nohup node server.js & " url = line.split(\"KoboldAI has finished loading and is available at the following link: \")[1]\n",
time.sleep(3) " print(url)\n",
print('###KoboldAI###') " break\n",
print(url) " if \"KoboldAI has finished loading and is available at the following link for UI 1: \" in line:\n",
print('') " print(line)\n",
print('###TavernAI LINK###') " url = line.split(\"KoboldAI has finished loading and is available at the following link for UI 1: \")[1]\n",
!lt --port 8000 " print(url)\n",
" break\n",
" if 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",
"#TavernAI\n",
"%cd /\n",
"!curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.37.2/install.sh | bash\n",
"!nvm install 19.1.0\n",
"!nvm use 19.1.0\n",
"!node -v\n",
"!git clone https://github.com/TavernAI/TavernAI.git\n",
"%cd TavernAI\n",
"!npm install\n",
"time.sleep(1)\n",
"%env colab=2\n",
"%env colaburl=$url\n",
"!nohup node server.js &\n",
"time.sleep(3)\n",
"print('###KoboldAI###')\n",
"print(url)\n",
"print('')\n",
"print('###TavernAI LINK###')\n",
"!lt --port 8000\n"
]
}
]
}