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//\\\\/\\\\/\\\\ //\\\\/\\\\ |__|_|_|__| \\__, //\\\\/\\\\/\\\\ //\\\\/\\\\/\\\\ ///\\\\\\\n",
@@ -42,9 +42,10 @@
"**Launch Instructions**<br>\n", "**Launch Instructions**<br>\n",
"1. Click the launch button.\n", "1. Click the launch button.\n",
"2. Wait for the environment and model to load\n", "2. Wait for the environment and model to load\n",
"3. After initialization, a TavernAI link will appear", "3. After initialization, a TavernAI link will appear\n",
"\n**Faq**<br>", "\n",
"* Q: I do not get a TavernAI link", "**Faq**<br>\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 become available again." "* A: It seems the localtunnel service is currently down, so the TavernAI link is unavailable. Need to wait for it to become available again."
], ],
"metadata": { "metadata": {
@@ -66,7 +67,7 @@
"Model = \"Pygmalion 6B\" #@param [ \"Pygmalion 6B\", \"Pygmalion 6B Dev\"] {allow-input: true}\n", "Model = \"Pygmalion 6B\" #@param [ \"Pygmalion 6B\", \"Pygmalion 6B Dev\"] {allow-input: true}\n",
"Version = \"Official\" \n", "Version = \"Official\" \n",
"Provider = \"Cloudflare\" \n", "Provider = \"Cloudflare\" \n",
"use_google_drive = False\n", "use_google_drive = False #@param {type:\"boolean\"}\n",
"\n", "\n",
"!nvidia-smi\n", "!nvidia-smi\n",
"import subprocess\n", "import subprocess\n",
@@ -74,8 +75,32 @@
"import sys\n", "import sys\n",
"import os\n", "import os\n",
"from google.colab import drive\n", "from google.colab import drive\n",
"def sync_files():\n",
" while True:\n",
" source_files = os.listdir(\"/taicolabtest/public/chats/\")\n",
" destination_files = os.listdir(\"/content/drive/MyDrive/TavernAI/chats\")\n",
"\n",
" new_files = set(source_files) - set(destination_files)\n",
" deleted_files = set(destination_files) - set(source_files)\n",
"\n",
" if new_files:\n",
" for file in new_files:\n",
" !cp /taicolabtest/public/chats/{file} /content/drive/MyDrive/TavernAI/chats\n",
"\n",
" if deleted_files:\n",
" for file in deleted_files:\n",
" !rm /content/drive/MyDrive/TavernAI/chats/{file}\n",
"\n",
" time.sleep(3) # Wait for 60 seconds before checking for changes again\n",
"\n",
"if use_google_drive:\n", "if use_google_drive:\n",
" drive.mount('/content/drive/')\n", " drive.mount('/content/drive/')\n",
" if not os.path.exists(\"/content/drive/MyDrive/TavernAI/\"):\n",
" os.mkdir(\"/content/drive/MyDrive/TavernAI/\")\n",
" if not os.path.exists(\"/content/drive/MyDrive/TavernAI/characters/\"):\n",
" os.mkdir(\"/content/drive/MyDrive/TavernAI/characters/\")\n",
" if not os.path.exists(\"/content/drive/MyDrive/TavernAI/chats/\"):\n",
" os.mkdir(\"/content/drive/MyDrive/TavernAI/chats/\")\n",
"else:\n", "else:\n",
" if not os.path.exists(\"/content/drive\"):\n", " if not os.path.exists(\"/content/drive\"):\n",
" os.mkdir(\"/content/drive\")\n", " os.mkdir(\"/content/drive\")\n",
@@ -140,6 +165,7 @@
"%env colaburl=$url\n", "%env colaburl=$url\n",
"!nohup node server.js &\n", "!nohup node server.js &\n",
"time.sleep(3)\n", "time.sleep(3)\n",
"\n",
"print('KoboldAI LINK:')\n", "print('KoboldAI LINK:')\n",
"print(url)\n", "print(url)\n",
"print('')\n", "print('')\n",