diff --git a/Colab-TextGen-GPU.ipynb b/Colab-TextGen-GPU.ipynb index 66953bdab1..1106bd8b15 100644 --- a/Colab-TextGen-GPU.ipynb +++ b/Colab-TextGen-GPU.ipynb @@ -19,6 +19,16 @@ "cells": [ { "cell_type": "markdown", + "metadata": { + "colab_type": "text", + "id": "view-in-github" + }, + "source": [ + "\"Open" + ] + }, + { + "cell_type": "markdown", "source": [ "# oobabooga/text-generation-webui\n", "\n", @@ -56,6 +66,13 @@ "import torch\n", "from pathlib import Path\n", "\n", + "# Parameters\n", + "model_url = \"https://huggingface.co/turboderp/Mistral-7B-instruct-exl2\" #@param {type:\"string\"}\n", + "branch = \"4.0bpw\" #@param {type:\"string\"}\n", + "command_line_flags = \"--n-gpu-layers 128 --load-in-4bit --use_double_quant\" #@param {type:\"string\"}\n", + "api = False #@param {type:\"boolean\"}\n", + "openai_api = False #@param {type: \"boolean\"}\n", + "\n", "if Path.cwd().name != 'text-generation-webui':\n", " print(\"Installing the webui...\")\n", "\n", @@ -75,7 +92,10 @@ " with open('temp_requirements.txt', 'w') as file:\n", " file.write('\\n'.join(textgen_requirements))\n", "\n", - " !pip install -r extensions/api/requirements.txt --upgrade\n", + " if openai_api:\n", + " !pip install -r extensions/openai/requirements.txt --upgrade\n", + " if api:\n", + " !pip install -r extensions/api/requirements.txt --upgrade\n", " !pip install -r temp_requirements.txt --upgrade\n", "\n", " print(\"\\033[1;32;1m\\n --> If you see a warning about \\\"previously imported packages\\\", just ignore it.\\033[0;37;0m\")\n", @@ -86,17 +106,14 @@ " except:\n", " !pip uninstall -y flash_attn\n", "\n", - "# Parameters\n", - "model_url = \"https://huggingface.co/turboderp/Mistral-7B-instruct-exl2\" #@param {type:\"string\"}\n", - "branch = \"4.0bpw\" #@param {type:\"string\"}\n", - "command_line_flags = \"--n-gpu-layers 128 --load-in-4bit --use_double_quant\" #@param {type:\"string\"}\n", - "api = False #@param {type:\"boolean\"}\n", - "\n", "if api:\n", " for param in ['--api', '--public-api']:\n", " if param not in command_line_flags:\n", " command_line_flags += f\" {param}\"\n", "\n", + "if openai_api and '--extensions' not in command_line_flags:\n", + " command_line_flags += f\" --extensions openai\"\n", + "\n", "model_url = model_url.strip()\n", "if model_url != \"\":\n", " if not model_url.startswith('http'):\n",