Add extras to colab

This commit is contained in:
SillyLossy
2023-03-01 19:55:29 +02:00
parent 3b30672b09
commit a297962b99

View File

@ -55,8 +55,8 @@
"cell_type": "code",
"execution_count": null,
"metadata": {
"id": "hps3qtPLFNBb",
"cellView": "form"
"cellView": "form",
"id": "hps3qtPLFNBb"
},
"outputs": [],
"source": [
@ -67,6 +67,7 @@
"Version = \"Official\" \n",
"KoboldAI_Provider = \"Localtunnel\" #@param [\"Localtunnel\", \"Cloudflare\"]\n",
"use_google_drive = True #@param {type:\"boolean\"}\n",
"extras_enable_captioning = False #@param {type:\"boolean\"}\n",
"Provider = KoboldAI_Provider\n",
"!nvidia-smi\n",
"import subprocess\n",
@ -159,6 +160,37 @@
" if \"INIT\" in line and \"Transformers\" in line:\n",
" print(\"Model loading... (It will take 2 - 5 minutes)\")\n",
"\n",
"ShareParam = \"--share\" if Provider == \"Cloudflare\" else \"\"\n",
"ExtrasModules = []\n",
"\n",
"if (extras_enable_captioning):\n",
" ExtrasModules.append('caption')\n",
"\n",
"ModulesParam = f'--enable-modules={\",\".join(ExtrasModules)}'\n",
"\n",
"#TavernAI extras\n",
"%cd /\n",
"!git clone https://github.com/SillyLossy/TavernAI-extras\n",
"%cd TavernAI-extras\n",
"!pip install -r requirements.txt\n",
"extras_process = subprocess.Popen(['python', 'server.py', '--cpu', ShareParam], stdout=subprocess.PIPE, stderr=subprocess.PIPE)\n",
"\n",
"while True:\n",
" line = p.stdout.readline().decode().strip()\n",
" if \"Running on \" in line and Provider != \"Cloudflare\":\n",
" print(\"TavernAI Extras URL:\")\n",
" !lt --port 5100\n",
" print('')\n",
" break\n",
" if \"Running on \" in line and Provider == \"Cloudflare\" and \"trycloudflare.com\" in line:\n",
" print(\"TavernAI Extras URL:\")\n",
" extras_url = line.split(\"Running on \")[1]\n",
" print(extras_url)\n",
" print('')\n",
" break\n",
" if not line:\n",
" break\n",
" print(line)\n",
"\n",
"#TavernAI\n",
"%cd /\n",
@ -166,7 +198,7 @@
"!nvm install 19.1.0\n",
"!nvm use 19.1.0\n",
"!node -v\n",
"!git clone https://github.com/TavernAI/TavernAIColab\n",
"!git clone -b dev https://github.com/SillyLossy/TavernAI\n",
"copy_characters(use_google_drive)\n",
"%cd TavernAIColab\n",
"!npm install\n",
@ -186,6 +218,7 @@
}
],
"metadata": {
"accelerator": "GPU",
"colab": {
"provenance": []
},
@ -196,9 +229,8 @@
},
"language_info": {
"name": "python"
},
"accelerator": "GPU"
}
},
"nbformat": 4,
"nbformat_minor": 0
}
}