forestcalled/text-generation-webui
Text generation web UI
A Gradio web UI for Large Language Models.
Its goal is to become the AUTOMATIC1111/stable-diffusion-webui of text generation.
Features
- 3 interface modes: default (two columns), notebook, and chat.
- Multiple model backends: Transformers, llama.cpp (through llama-cpp-python), ExLlama, ExLlamaV2, AutoGPTQ, AutoAWQ, GPTQ-for-LLaMa, CTransformers, QuIP#.
- Dropdown menu for quickly switching between different models.
- Large number of extensions (built-in and user-contributed), including Coqui TTS for realistic voice outputs, Whisper STT for voice inputs, translation, multimodal pipelines, vector databases, Stable Diffusion integration, and a lot more. See the wiki and the extensions directory for details.
- Chat with custom characters.
- Precise chat templates for instruction-following models, including Llama-2-chat, Alpaca, Vicuna, Mistral.
- LoRA: train new LoRAs with your own data, load/unload LoRAs on the fly for generation.
- Transformers library integration: load models in 4-bit or 8-bit precision through bitsandbytes, use llama.cpp with transformers samplers (
llamacpp_HFloader), CPU inference in 32-bit precision using PyTorch. - OpenAI-compatible API server with Chat and Completions endpoints -- see the examples.
How to install
1) Clone or download the repository. 2) Run the start_linux.sh, start_windows.bat, start_macos.sh, or start_wsl.bat script depending on your OS. 3) Select your GPU vendor when asked. 4) Once the installation ends, browse to http://localhost:7860/?__theme=dark. 5) Have fun!
To restart the web UI in the future, just run the start_ script again. This script creates an installer_files folder where it sets up the project's requirements. In case you need to reinstall the requirements, you can simply delete that folder and start the web UI again.
The script accepts command-line flags. Alternatively, you can edit the CMD_FLAGS.txt file with a text editor and add your flags there.
To get updates in the future, run update_linux.sh, update_windows.bat, update_macos.sh, or update_wsl.bat.
<details> <summary> Setup details and information about installing manually </summary>
One-click-installer
The script uses Miniconda to set up a Conda environment in the installer_files folder.
If you ever need to install something manually in the installer_files environment, you can launch an interactive shell using the cmd script: cmd_linux.sh, cmd_windows.bat, cmd_macos.sh, or cmd_wsl.bat.
- There is no need to run any of those scripts (
start_,update_, orcmd_) as admin/root. - For additional instructions about AMD and WSL setup, consult the documentation.
- For automated installation, you can use the
GPU_CHOICE,USE_CUDA118,LAUNCH_AFTER_INSTALL, andINSTALL_EXTENSIONSenvironment variables. For instance:GPU_CHOICE=A USE_CUDA118=FALSE LAUNCH_AFTER_INSTALL=FALSE INSTALL_EXTENSIONS=FALSE ./start_linux.sh.
Manual installation using Conda
Recommended if you have some experience with the command-line.
0. Install Conda
https://docs.conda.io/en/latest/miniconda.html
On Linux or WSL, it can be automatically installed with these two commands (source):
curl -sL "https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh" > "Miniconda3.sh"
bash Miniconda3.sh1. Create a new conda environment
conda create -n textgen python=3.11
conda activate textgen2. Install Pytorch
The up-to-date commands can be found here: https://pytorch.org/get-started/locally/.
For NVIDIA, you also need to install the CUDA runtime libraries:
conda install -y -c "nvidia/label/cuda-12.1.1" cuda-runtimeIf you need nvcc to compile some library manually, replace the command above with
conda install -y -c "nvidia/label/cuda-12.1.1" cuda3. Install the web UI
git clone https://github.com/oobabooga/text-generation-webui
cd text-generation-webui
pip install -r <requirements file according to table below>Requirements file to use:
Start the web UI
conda activate textgen
cd text-generation-webui
python server.pyThen browse to
http://localhost:7860/?__theme=dark
AMD GPU on Windows
1) Use requirements_cpu_only.txt or requirements_cpu_only_noavx2.txt in the command above.
2) Manually install llama-cpp-python using the appropriate command for your hardware: Installation from PyPI.
- Use the
LLAMA_HIPBLAS=ontoggle. - Note the Windows remarks.
3) Manually install AutoGPTQ: Installation.
- Perform the from-source installation - there are no prebuilt ROCm packages for Windows.
4) Manually install ExLlama by simply cloning it into the repositories folder (it will be automatically compiled at runtime after that):
cd text-generation-webui
git clone https://github.com/turboderp/exllama repositories/exllamaOlder NVIDIA GPUs
1) For Kepler GPUs and older, you will need to install CUDA 11.8 instead of 12:
pip3 install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu118
conda install -y -c "nvidia/label/cuda-11.8.0" cuda-runtime2) bitsandbytes >= 0.39 may not work. In that case, to use --load-in-8bit, you may have to downgrade like this:
- Linux:
pip install bitsandbytes==0.38.1 - Windows:
pip install https://github.com/jllllll/bitsandbytes-windows-webui/raw/main/bitsandbytes-0.38.1-py3-none-any.whl
Manual install
The requirements*.txt above contain various wheels precompiled through GitHub Actions. If you wish to compile things manually, or if you need to because no suitable wheels are available for your hardware, you can use requirements_nowheels.txt and then install your desired loaders manually.
Alternative: Docker
ln -s docker/{nvidia/Dockerfile,docker-compose.yml,.dockerignore} .
cp docker/.env.example .env
# Edit .env and set:
# TORCH_CUDA_ARCH_LIST based on your GPU model
# APP_RUNTIME_GID your host user's group id (run `id -g` in a terminal)
# BUILD_EXTENIONS optionally add comma separated list of extensions to build
docker compose up --build- You need to have Docker Compose v2.17 or higher installed. See this guide for instructions.
- For additional docker files, check out this repository.
Updating the requirements
From time to time, the requirements*.txt change. To update, use these commands:
conda activate textgen
cd text-generation-webui
pip install -r <requirements file that you have used> --upgrade</details>
<details> <summary> List of command-line flags </summary>
Basic settings
Model loader
Accelerate/transformers
bitsandbytes 4-bit
⚠️ Requires minimum compute of 7.0 on Windows at the moment.
llama.cpp
ExLlama
AutoGPTQ
GPTQ-for-LLaMa
ctransformers
HQQ
DeepSpeed
RWKV
RoPE (for llama.cpp, ExLlama, ExLlamaV2, and transformers)
Gradio
API
Multimodal
</details>
Documentation
https://github.com/oobabooga/text-generation-webui/wiki
Downloading models
Models should be placed in the folder text-generation-webui/models. They are usually downloaded from Hugging Face.
- GGUF models are a single file and should be placed directly into
models. Example:
text-generation-webui
└── models
└── llama-2-13b-chat.Q4_K_M.gguf- The remaining model types (like 16-bit transformers models and GPTQ models) are made of several files and must be placed in a subfolder. Example:
text-generation-webui
├── models
│ ├── lmsys_vicuna-33b-v1.3
│ │ ├── config.json
│ │ ├── generation_config.json
│ │ ├── pytorch_model-00001-of-00007.bin
│ │ ├── pytorch_model-00002-of-00007.bin
│ │ ├── pytorch_model-00003-of-00007.bin
│ │ ├── pytorch_model-00004-of-00007.bin
│ │ ├── pytorch_model-00005-of-00007.bin
│ │ ├── pytorch_model-00006-of-00007.bin
│ │ ├── pytorch_model-00007-of-00007.bin
│ │ ├── pytorch_model.bin.index.json
│ │ ├── special_tokens_map.json
│ │ ├── tokenizer_config.json
│ │ └── tokenizer.modelIn both cases, you can use the "Model" tab of the UI to download the model from Hugging Face automatically. It is also possible to download it via the command-line with
python download-model.py organization/modelRun python download-model.py --help to see all the options.
Google Colab notebook
https://colab.research.google.com/github/oobabooga/text-generation-webui/blob/main/Colab-TextGen-GPU.ipynb
Contributing
If you would like to contribute to the project, check out the Contributing guidelines.
Community
- Subreddit: https://www.reddit.com/r/oobabooga/
- Discord: https://discord.gg/jwZCF2dPQN
Acknowledgment & support
In August 2023, Andreessen Horowitz (a16z) provided a generous grant to encourage and support my independent work on this project. I am extremely grateful for their trust and recognition.
If you find this project useful, I have a Ko-fi page where you can make a donation. Your support helps me continue maintaining and improving this project.


