# Text generation web UI
A gradio web UI for running Large Language Models like LLaMA, llama.cpp, GPT-J, OPT, and GALACTICA.
Its goal is to become the [AUTOMATIC1111/stable-diffusion-webui](https://github.com/AUTOMATIC1111/stable-diffusion-webui) of text generation.
|![Image1](https://github.com/oobabooga/screenshots/raw/main/qa.png) | ![Image2](https://github.com/oobabooga/screenshots/raw/main/cai3.png) |
|:---:|:---:|
|![Image3](https://github.com/oobabooga/screenshots/raw/main/gpt4chan.png) | ![Image4](https://github.com/oobabooga/screenshots/raw/main/galactica.png) |
## Features
* 3 interface modes: default, notebook, and chat
* Multiple model backends: transformers, llama.cpp, ExLlama, AutoGPTQ, GPTQ-for-LLaMa
* Dropdown menu for quickly switching between different models
* LoRA: load and unload LoRAs on the fly, train a new LoRA
* Precise instruction templates for chat mode, including Llama 2, Alpaca, Vicuna, WizardLM, StableLM, and many others
* [Multimodal pipelines, including LLaVA and MiniGPT-4](https://github.com/oobabooga/text-generation-webui/tree/main/extensions/multimodal)
* 8-bit and 4-bit inference through bitsandbytes
* CPU mode for transformers models
* [DeepSpeed ZeRO-3 inference](docs/DeepSpeed.md)
* [Extensions](docs/Extensions.md)
* [Custom chat characters](docs/Chat-mode.md)
* Very efficient text streaming
* Markdown output with LaTeX rendering, to use for instance with [GALACTICA](https://github.com/paperswithcode/galai)
* Nice HTML output for GPT-4chan
* API, including endpoints for websocket streaming ([see the examples](https://github.com/oobabooga/text-generation-webui/blob/main/api-examples))
To learn how to use the various features, check out the Documentation: https://github.com/oobabooga/text-generation-webui/tree/main/docs
## Installation
### One-click installers
| Windows | Linux | macOS | WSL |
|--------|--------|--------|--------|
| [oobabooga-windows.zip](https://github.com/oobabooga/text-generation-webui/releases/download/installers/oobabooga_windows.zip) | [oobabooga-linux.zip](https://github.com/oobabooga/text-generation-webui/releases/download/installers/oobabooga_linux.zip) |[oobabooga-macos.zip](https://github.com/oobabooga/text-generation-webui/releases/download/installers/oobabooga_macos.zip) | [oobabooga-wsl.zip](https://github.com/oobabooga/text-generation-webui/releases/download/installers/oobabooga_wsl.zip) |
Just download the zip above, extract it, and double-click on "start". The web UI and all its dependencies will be installed in the same folder.
* The source codes are here: https://github.com/oobabooga/one-click-installers
* There is no need to run the installers as admin.
* AMD doesn't work on Windows.
* Huge thanks to [@jllllll](https://github.com/jllllll), [@ClayShoaf](https://github.com/ClayShoaf), and [@xNul](https://github.com/xNul) for their contributions to these installers.
### 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:
```
curl -sL "https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh" > "Miniconda3.sh"
bash Miniconda3.sh
```
Source: https://educe-ubc.github.io/conda.html
#### 1. Create a new conda environment
```
conda create -n textgen python=3.10.9
conda activate textgen
```
#### 2. Install Pytorch
| System | GPU | Command |
|--------|---------|---------|
| Linux/WSL | NVIDIA | `pip3 install torch torchvision torchaudio` |
| Linux/WSL | CPU only | `pip3 install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cpu` |
| Linux | AMD | `pip3 install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/rocm5.4.2` |
| MacOS + MPS | Any | `pip3 install torch torchvision torchaudio` |
| Windows | NVIDIA | `pip3 install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu117` |
| Windows | CPU only | `pip3 install torch torchvision torchaudio` |
The up-to-date commands can be found here: https://pytorch.org/get-started/locally/.
#### 2.1 Special instructions
* MacOS users: https://github.com/oobabooga/text-generation-webui/pull/393
* AMD users: https://rentry.org/eq3hg
#### 3. Install the web UI
```
git clone https://github.com/oobabooga/text-generation-webui
cd text-generation-webui
pip install -r requirements.txt
```
#### bitsandbytes
bitsandbytes >= 0.39 may not work on older NVIDIA GPUs. 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`
### Alternative: Docker
```
ln -s docker/{Dockerfile,docker-compose.yml,.dockerignore} .
cp docker/.env.example .env
# Edit .env and set TORCH_CUDA_ARCH_LIST based on your GPU model
docker compose up --build
```
* You need to have docker compose v2.17 or higher installed. See [this guide](https://github.com/oobabooga/text-generation-webui/blob/main/docs/Docker.md) for instructions.
* For additional docker files, check out [this repository](https://github.com/Atinoda/text-generation-webui-docker).
### Updating the requirements
From time to time, the `requirements.txt` changes. To update, use this command:
```
conda activate textgen
cd text-generation-webui
pip install -r requirements.txt --upgrade
```
## Downloading models
Models should be placed inside the `models/` folder.
[Hugging Face](https://huggingface.co/models?pipeline_tag=text-generation&sort=downloads) is the main place to download models. These are some examples:
* [Pythia](https://huggingface.co/models?sort=downloads&search=eleutherai%2Fpythia+deduped)
* [OPT](https://huggingface.co/models?search=facebook/opt)
* [GALACTICA](https://huggingface.co/models?search=facebook/galactica)
* [GPT-J 6B](https://huggingface.co/EleutherAI/gpt-j-6B/tree/main)
You can automatically download a model from HF using the script `download-model.py`:
python download-model.py organization/model
For example:
python download-model.py facebook/opt-1.3b
To download a protected model, set env vars `HF_USER` and `HF_PASS` to your Hugging Face username and password (or [User Access Token](https://huggingface.co/settings/tokens)). The model's terms must first be accepted on the HF website.
#### GGML models
You can drop these directly into the `models/` folder, making sure that the file name contains `ggml` somewhere and ends in `.bin`.
#### GPT-4chan
<details>
<summary>
Instructions
</summary>
[GPT-4chan](https://huggingface.co/ykilcher/gpt-4chan) has been shut down from Hugging Face, so you need to download it elsewhere. You have two options:
* Torrent: [16-bit](https://archive.org/details/gpt4chan_model_float16) / [32-bit](https://archive.org/details/gpt4chan_model)
* Direct download: [16-bit](https://theswissbay.ch/pdf/_notpdf_/gpt4chan_model_float16/) / [32-bit](https://theswissbay.ch/pdf/_notpdf_/gpt4chan_model/)
The 32-bit version is only relevant if you intend to run the model in CPU mode. Otherwise, you should use the 16-bit version.
After downloading the model, follow these steps:
1. Place the files under `models/gpt4chan_model_float16` or `models/gpt4chan_model`.
2. Place GPT-J 6B's config.json file in that same folder: [config.json](https://huggingface.co/EleutherAI/gpt-j-6B/raw/main/config.json).
3. Download GPT-J 6B's tokenizer files (they will be automatically detected when you attempt to load GPT-4chan):
```
python download-model.py EleutherAI/gpt-j-6B --text-only
```
When you load this model in default or notebook modes, the "HTML" tab will show the generated text in 4chan format.
</details>
## Starting the web UI
conda activate textgen
cd text-generation-webui
python server.py
Then browse to
`http://localhost:7860/?__theme=dark`
Optionally, you can use the f
没有合适的资源?快使用搜索试试~ 我知道了~
text-generation-webui-main
共232个文件
py:85个
yaml:71个
md:29个
需积分: 0 2 下载量 70 浏览量
2023-09-20
16:57:56
上传
评论 1
收藏 501KB ZIP 举报
温馨提示
多种模型后端: transformers、llama.cpp、ExLlama、AutoGPTQ、GPTQ-for-LaMa、ctransformers
资源推荐
资源详情
资源评论
收起资源包目录
text-generation-webui-main (232个子文件)
main.css 3KB
chat_style-TheEncrypted777.css 3KB
chat.css 3KB
html_4chan_style.css 2KB
chat_style-messenger.css 2KB
html_instruct_style.css 1KB
style.css 1KB
chat_style-cai-chat.css 985B
chat_style-wpp.css 931B
html_readable_style.css 549B
style.css 153B
Dockerfile 3KB
.dockerignore 84B
.env.example 1KB
.gitignore 435B
Dockerfile.jetson 2KB
save_files.js 1KB
main.js 1KB
alpaca-format.json 478B
vicuna-format.json 231B
alpaca-chatbot-format.json 158B
LICENSE 34KB
README.md 19KB
README.md 13KB
Training-LoRAs.md 12KB
Extensions.md 11KB
GPTQ-models-(4-bit-mode).md 8KB
Docker.md 7KB
README.md 7KB
DOCS.md 6KB
README.MD 4KB
WSL-installation-guide.md 3KB
Spell-book.md 3KB
RWKV-model.md 3KB
LoRA.md 3KB
README.md 2KB
Chat-mode.md 2KB
LLaMA-model.md 2KB
System-requirements.md 2KB
Low-VRAM-guide.md 1KB
llama.cpp.md 1KB
LLaMA-v2-model.md 982B
DeepSpeed.md 923B
ExLlama.md 762B
Audio-Notification.md 740B
README.md 675B
README.md 579B
readme.md 498B
Windows-installation-guide.md 415B
feature_request.md 354B
pull_request_template.md 145B
Example.png 206KB
training.py 38KB
completions.py 26KB
chat.py 22KB
ui_chat.py 18KB
ui_model_menu.py 16KB
script.py 16KB
shared.py 15KB
models.py 13KB
text_generation.py 12KB
ui_parameters.py 11KB
script.py 11KB
download-model.py 10KB
script.py 10KB
script.py 9KB
script.py 9KB
html_generator.py 9KB
sampler_hijack.py 9KB
server.py 9KB
llama_attn_hijack.py 8KB
multimodal_embedder.py 8KB
GPTQ_loader.py 7KB
exllama.py 7KB
extensions.py 7KB
script.py 7KB
loaders.py 7KB
blocking_api.py 7KB
util.py 7KB
ui_file_saving.py 6KB
tts_preprocessor.py 6KB
evaluate.py 6KB
ui_notebook.py 6KB
ui_default.py 5KB
RWKV.py 5KB
LoRA.py 5KB
ui.py 5KB
llava.py 5KB
exllama_hf.py 5KB
api-example-model.py 5KB
models_settings.py 5KB
llamacpp_hf.py 4KB
chromadb.py 4KB
llamacpp_model.py 4KB
edits.py 4KB
utils.py 4KB
script.py 4KB
ui_session.py 4KB
logging_colors.py 4KB
script.py 4KB
共 232 条
- 1
- 2
- 3
资源评论
weixin_45427175
- 粉丝: 0
- 资源: 1
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功