GithubHelp home page GithubHelp logo

oobabooga / text-generation-webui Goto Github PK

View Code? Open in Web Editor NEW
38.4K 328.0 5.1K 27.83 MB

A Gradio web UI for Large Language Models.

License: GNU Affero General Public License v3.0

Python 90.45% CSS 3.34% JavaScript 3.09% Dockerfile 0.54% Shell 1.33% Batchfile 0.70% Jupyter Notebook 0.55%

text-generation-webui's Introduction

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.

Image1 Image2
Image1 Image2

Features

  • 3 interface modes: default (two columns), notebook, and chat.
  • Multiple model backends: Transformers, llama.cpp (through llama-cpp-python), ExLlamaV2, AutoGPTQ, AutoAWQ, TensorRT-LLM.
  • 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_HF loader), 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_wizard_linux.sh, update_wizard_windows.bat, update_wizard_macos.sh, or update_wizard_wsl.bat.

Setup details and information about installing manually

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_wizard_, or cmd_) as admin/root.
  • To install the requirements for extensions, you can use the extensions_reqs script for your OS. At the end, this script will install the main requirements for the project to make sure that they take precedence in case of version conflicts.
  • 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, and INSTALL_EXTENSIONS environment variables. For instance: GPU_CHOICE=A USE_CUDA118=FALSE LAUNCH_AFTER_INSTALL=FALSE INSTALL_EXTENSIONS=TRUE ./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.sh

1. Create a new conda environment

conda create -n textgen python=3.11
conda activate textgen

2. Install Pytorch

System GPU Command
Linux/WSL NVIDIA pip3 install torch==2.2.2 torchvision==0.17.2 torchaudio==2.2.2 --index-url https://download.pytorch.org/whl/cu121
Linux/WSL CPU only pip3 install torch==2.2.2 torchvision==0.17.2 torchaudio==2.2.2 --index-url https://download.pytorch.org/whl/cpu
Linux AMD pip3 install torch==2.2.2 torchvision==0.17.2 torchaudio==2.2.2 --index-url https://download.pytorch.org/whl/rocm5.6
MacOS + MPS Any pip3 install torch==2.2.2 torchvision==0.17.2 torchaudio==2.2.2
Windows NVIDIA pip3 install torch==2.2.2 torchvision==0.17.2 torchaudio==2.2.2 --index-url https://download.pytorch.org/whl/cu121
Windows CPU only pip3 install torch==2.2.2 torchvision==0.17.2 torchaudio==2.2.2

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-runtime

If you need nvcc to compile some library manually, replace the command above with

conda install -y -c "nvidia/label/cuda-12.1.1" cuda

3. 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:

GPU CPU requirements file to use
NVIDIA has AVX2 requirements.txt
NVIDIA no AVX2 requirements_noavx2.txt
AMD has AVX2 requirements_amd.txt
AMD no AVX2 requirements_amd_noavx2.txt
CPU only has AVX2 requirements_cpu_only.txt
CPU only no AVX2 requirements_cpu_only_noavx2.txt
Apple Intel requirements_apple_intel.txt
Apple Apple Silicon requirements_apple_silicon.txt

Start the web UI

conda activate textgen
cd text-generation-webui
python server.py

Then 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.

  3. Manually install AutoGPTQ: Installation.

    • Perform the from-source installation - there are no prebuilt ROCm packages for Windows.
Older NVIDIA GPUs
  1. For Kepler GPUs and older, you will need to install CUDA 11.8 instead of 12:
pip3 install torch==2.2.2 torchvision==0.17.2 torchaudio==2.2.2 --index-url https://download.pytorch.org/whl/cu118
conda install -y -c "nvidia/label/cuda-11.8.0" cuda-runtime
  1. 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

For NVIDIA GPU:
ln -s docker/{nvidia/Dockerfile,nvidia/docker-compose.yml,.dockerignore} .
For AMD GPU: 
ln -s docker/{amd/Dockerfile,intel/docker-compose.yml,.dockerignore} .
For Intel GPU:
ln -s docker/{intel/Dockerfile,amd/docker-compose.yml,.dockerignore} .
For CPU only
ln -s docker/{cpu/Dockerfile,cpu/docker-compose.yml,.dockerignore} .
cp docker/.env.example .env
#Create logs/cache dir : 
mkdir -p logs cache
# 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
# Edit CMD_FLAGS.txt and add in it the options you want to execute (like --listen --cpu)
# 
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
List of command-line flags
usage: server.py [-h] [--multi-user] [--character CHARACTER] [--model MODEL] [--lora LORA [LORA ...]] [--model-dir MODEL_DIR] [--lora-dir LORA_DIR] [--model-menu] [--settings SETTINGS]
                 [--extensions EXTENSIONS [EXTENSIONS ...]] [--verbose] [--chat-buttons] [--idle-timeout IDLE_TIMEOUT] [--loader LOADER] [--cpu] [--auto-devices]
                 [--gpu-memory GPU_MEMORY [GPU_MEMORY ...]] [--cpu-memory CPU_MEMORY] [--disk] [--disk-cache-dir DISK_CACHE_DIR] [--load-in-8bit] [--bf16] [--no-cache] [--trust-remote-code]
                 [--force-safetensors] [--no_use_fast] [--use_flash_attention_2] [--load-in-4bit] [--use_double_quant] [--compute_dtype COMPUTE_DTYPE] [--quant_type QUANT_TYPE] [--flash-attn]
                 [--tensorcores] [--n_ctx N_CTX] [--threads THREADS] [--threads-batch THREADS_BATCH] [--no_mul_mat_q] [--n_batch N_BATCH] [--no-mmap] [--mlock] [--n-gpu-layers N_GPU_LAYERS]
                 [--tensor_split TENSOR_SPLIT] [--numa] [--logits_all] [--no_offload_kqv] [--cache-capacity CACHE_CAPACITY] [--row_split] [--streaming-llm] [--attention-sink-size ATTENTION_SINK_SIZE]
                 [--gpu-split GPU_SPLIT] [--autosplit] [--max_seq_len MAX_SEQ_LEN] [--cfg-cache] [--no_flash_attn] [--cache_8bit] [--cache_4bit] [--num_experts_per_token NUM_EXPERTS_PER_TOKEN]
                 [--triton] [--no_inject_fused_mlp] [--no_use_cuda_fp16] [--desc_act] [--disable_exllama] [--disable_exllamav2] [--wbits WBITS] [--groupsize GROUPSIZE] [--no_inject_fused_attention]
                 [--hqq-backend HQQ_BACKEND] [--deepspeed] [--nvme-offload-dir NVME_OFFLOAD_DIR] [--local_rank LOCAL_RANK] [--alpha_value ALPHA_VALUE] [--rope_freq_base ROPE_FREQ_BASE]
                 [--compress_pos_emb COMPRESS_POS_EMB] [--listen] [--listen-port LISTEN_PORT] [--listen-host LISTEN_HOST] [--share] [--auto-launch] [--gradio-auth GRADIO_AUTH]
                 [--gradio-auth-path GRADIO_AUTH_PATH] [--ssl-keyfile SSL_KEYFILE] [--ssl-certfile SSL_CERTFILE] [--api] [--public-api] [--public-api-id PUBLIC_API_ID] [--api-port API_PORT]
                 [--api-key API_KEY] [--admin-key ADMIN_KEY] [--nowebui] [--multimodal-pipeline MULTIMODAL_PIPELINE] [--model_type MODEL_TYPE] [--pre_layer PRE_LAYER [PRE_LAYER ...]]
                 [--checkpoint CHECKPOINT] [--monkey-patch]

Text generation web UI

options:
  -h, --help                                     show this help message and exit

Basic settings:
  --multi-user                                   Multi-user mode. Chat histories are not saved or automatically loaded. Warning: this is likely not safe for sharing publicly.
  --character CHARACTER                          The name of the character to load in chat mode by default.
  --model MODEL                                  Name of the model to load by default.
  --lora LORA [LORA ...]                         The list of LoRAs to load. If you want to load more than one LoRA, write the names separated by spaces.
  --model-dir MODEL_DIR                          Path to directory with all the models.
  --lora-dir LORA_DIR                            Path to directory with all the loras.
  --model-menu                                   Show a model menu in the terminal when the web UI is first launched.
  --settings SETTINGS                            Load the default interface settings from this yaml file. See settings-template.yaml for an example. If you create a file called settings.yaml, this
                                                 file will be loaded by default without the need to use the --settings flag.
  --extensions EXTENSIONS [EXTENSIONS ...]       The list of extensions to load. If you want to load more than one extension, write the names separated by spaces.
  --verbose                                      Print the prompts to the terminal.
  --chat-buttons                                 Show buttons on the chat tab instead of a hover menu.
  --idle-timeout IDLE_TIMEOUT                    Unload model after this many minutes of inactivity. It will be automatically reloaded when you try to use it again.

Model loader:
  --loader LOADER                                Choose the model loader manually, otherwise, it will get autodetected. Valid options: Transformers, llama.cpp, llamacpp_HF, ExLlamav2_HF, ExLlamav2,
                                                 AutoGPTQ, AutoAWQ.

Transformers/Accelerate:
  --cpu                                          Use the CPU to generate text. Warning: Training on CPU is extremely slow.
  --auto-devices                                 Automatically split the model across the available GPU(s) and CPU.
  --gpu-memory GPU_MEMORY [GPU_MEMORY ...]       Maximum GPU memory in GiB to be allocated per GPU. Example: --gpu-memory 10 for a single GPU, --gpu-memory 10 5 for two GPUs. You can also set values
                                                 in MiB like --gpu-memory 3500MiB.
  --cpu-memory CPU_MEMORY                        Maximum CPU memory in GiB to allocate for offloaded weights. Same as above.
  --disk                                         If the model is too large for your GPU(s) and CPU combined, send the remaining layers to the disk.
  --disk-cache-dir DISK_CACHE_DIR                Directory to save the disk cache to. Defaults to "cache".
  --load-in-8bit                                 Load the model with 8-bit precision (using bitsandbytes).
  --bf16                                         Load the model with bfloat16 precision. Requires NVIDIA Ampere GPU.
  --no-cache                                     Set use_cache to False while generating text. This reduces VRAM usage slightly, but it comes at a performance cost.
  --trust-remote-code                            Set trust_remote_code=True while loading the model. Necessary for some models.
  --force-safetensors                            Set use_safetensors=True while loading the model. This prevents arbitrary code execution.
  --no_use_fast                                  Set use_fast=False while loading the tokenizer (it's True by default). Use this if you have any problems related to use_fast.
  --use_flash_attention_2                        Set use_flash_attention_2=True while loading the model.

bitsandbytes 4-bit:
  --load-in-4bit                                 Load the model with 4-bit precision (using bitsandbytes).
  --use_double_quant                             use_double_quant for 4-bit.
  --compute_dtype COMPUTE_DTYPE                  compute dtype for 4-bit. Valid options: bfloat16, float16, float32.
  --quant_type QUANT_TYPE                        quant_type for 4-bit. Valid options: nf4, fp4.

llama.cpp:
  --flash-attn                                   Use flash-attention.
  --tensorcores                                  Use llama-cpp-python compiled with tensor cores support. This increases performance on RTX cards. NVIDIA only.
  --n_ctx N_CTX                                  Size of the prompt context.
  --threads THREADS                              Number of threads to use.
  --threads-batch THREADS_BATCH                  Number of threads to use for batches/prompt processing.
  --no_mul_mat_q                                 Disable the mulmat kernels.
  --n_batch N_BATCH                              Maximum number of prompt tokens to batch together when calling llama_eval.
  --no-mmap                                      Prevent mmap from being used.
  --mlock                                        Force the system to keep the model in RAM.
  --n-gpu-layers N_GPU_LAYERS                    Number of layers to offload to the GPU.
  --tensor_split TENSOR_SPLIT                    Split the model across multiple GPUs. Comma-separated list of proportions. Example: 18,17.
  --numa                                         Activate NUMA task allocation for llama.cpp.
  --logits_all                                   Needs to be set for perplexity evaluation to work. Otherwise, ignore it, as it makes prompt processing slower.
  --no_offload_kqv                               Do not offload the K, Q, V to the GPU. This saves VRAM but reduces the performance.
  --cache-capacity CACHE_CAPACITY                Maximum cache capacity (llama-cpp-python). Examples: 2000MiB, 2GiB. When provided without units, bytes will be assumed.
  --row_split                                    Split the model by rows across GPUs. This may improve multi-gpu performance.
  --streaming-llm                                Activate StreamingLLM to avoid re-evaluating the entire prompt when old messages are removed.
  --attention-sink-size ATTENTION_SINK_SIZE      StreamingLLM: number of sink tokens. Only used if the trimmed prompt does not share a prefix with the old prompt.

ExLlamaV2:
  --gpu-split GPU_SPLIT                          Comma-separated list of VRAM (in GB) to use per GPU device for model layers. Example: 20,7,7.
  --autosplit                                    Autosplit the model tensors across the available GPUs. This causes --gpu-split to be ignored.
  --max_seq_len MAX_SEQ_LEN                      Maximum sequence length.
  --cfg-cache                                    ExLlamav2_HF: Create an additional cache for CFG negative prompts. Necessary to use CFG with that loader.
  --no_flash_attn                                Force flash-attention to not be used.
  --cache_8bit                                   Use 8-bit cache to save VRAM.
  --cache_4bit                                   Use Q4 cache to save VRAM.
  --num_experts_per_token NUM_EXPERTS_PER_TOKEN  Number of experts to use for generation. Applies to MoE models like Mixtral.

AutoGPTQ:
  --triton                                       Use triton.
  --no_inject_fused_mlp                          Triton mode only: disable the use of fused MLP, which will use less VRAM at the cost of slower inference.
  --no_use_cuda_fp16                             This can make models faster on some systems.
  --desc_act                                     For models that do not have a quantize_config.json, this parameter is used to define whether to set desc_act or not in BaseQuantizeConfig.
  --disable_exllama                              Disable ExLlama kernel, which can improve inference speed on some systems.
  --disable_exllamav2                            Disable ExLlamav2 kernel.
  --wbits WBITS                                  Load a pre-quantized model with specified precision in bits. 2, 3, 4 and 8 are supported.
  --groupsize GROUPSIZE                          Group size.

AutoAWQ:
  --no_inject_fused_attention                    Disable the use of fused attention, which will use less VRAM at the cost of slower inference.

HQQ:
  --hqq-backend HQQ_BACKEND                      Backend for the HQQ loader. Valid options: PYTORCH, PYTORCH_COMPILE, ATEN.

DeepSpeed:
  --deepspeed                                    Enable the use of DeepSpeed ZeRO-3 for inference via the Transformers integration.
  --nvme-offload-dir NVME_OFFLOAD_DIR            DeepSpeed: Directory to use for ZeRO-3 NVME offloading.
  --local_rank LOCAL_RANK                        DeepSpeed: Optional argument for distributed setups.

RoPE:
  --alpha_value ALPHA_VALUE                      Positional embeddings alpha factor for NTK RoPE scaling. Use either this or compress_pos_emb, not both.
  --rope_freq_base ROPE_FREQ_BASE                If greater than 0, will be used instead of alpha_value. Those two are related by rope_freq_base = 10000 * alpha_value ^ (64 / 63).
  --compress_pos_emb COMPRESS_POS_EMB            Positional embeddings compression factor. Should be set to (context length) / (model's original context length). Equal to 1/rope_freq_scale.

Gradio:
  --listen                                       Make the web UI reachable from your local network.
  --listen-port LISTEN_PORT                      The listening port that the server will use.
  --listen-host LISTEN_HOST                      The hostname that the server will use.
  --share                                        Create a public URL. This is useful for running the web UI on Google Colab or similar.
  --auto-launch                                  Open the web UI in the default browser upon launch.
  --gradio-auth GRADIO_AUTH                      Set Gradio authentication password in the format "username:password". Multiple credentials can also be supplied with "u1:p1,u2:p2,u3:p3".
  --gradio-auth-path GRADIO_AUTH_PATH            Set the Gradio authentication file path. The file should contain one or more user:password pairs in the same format as above.
  --ssl-keyfile SSL_KEYFILE                      The path to the SSL certificate key file.
  --ssl-certfile SSL_CERTFILE                    The path to the SSL certificate cert file.

API:
  --api                                          Enable the API extension.
  --public-api                                   Create a public URL for the API using Cloudfare.
  --public-api-id PUBLIC_API_ID                  Tunnel ID for named Cloudflare Tunnel. Use together with public-api option.
  --api-port API_PORT                            The listening port for the API.
  --api-key API_KEY                              API authentication key.
  --admin-key ADMIN_KEY                          API authentication key for admin tasks like loading and unloading models. If not set, will be the same as --api-key.
  --nowebui                                      Do not launch the Gradio UI. Useful for launching the API in standalone mode.

Multimodal:
  --multimodal-pipeline MULTIMODAL_PIPELINE      The multimodal pipeline to use. Examples: llava-7b, llava-13b.

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.model

In 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/model

Run 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

Acknowledgment

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.

Links

Community

Support

text-generation-webui's People

Contributors

badisg avatar brawlence avatar cal066 avatar carlkenner avatar casper-hansen avatar catalpaaa avatar cebtenzzre avatar dependabot[bot] avatar eliasvincent avatar fartypants avatar guizzyqc avatar honkware avatar jllllll avatar kalomaze avatar matatonic avatar mayaeary avatar mcmonkey4eva avatar missionfloyd avatar netrunnereve avatar oobabooga avatar sammcj avatar sgsdxzy avatar thelounger avatar thomasantony avatar toast22a avatar touch-night avatar wojtab avatar xanthousm avatar yiximail avatar zerogoki00 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

text-generation-webui's Issues

Feature Request: Add support for API keys.

Would like to see support for API keys in Text Generation WebUI. I'd mainly like to see support for OpenAI's API key, so we can use the Davinci model with a good fucking UI (Fuck Playground)
But being able to use Kobold API links, for TPU's and NovelAI's API for those poor souls who haven't moved on, would probably be nice for those folks.

Probably a pipe dream, I remember reading somewhere you hate bloat, and it'd probably be hard to implement, but might as well shoot my shot.

(Sorry for making two of these, I'm an idiot and thought you let us tag these ourselves)

Couldn't start server on WSL, It always get killed

Hello,

I'm trying to start the server in WSL2, but whenever I do python server.py It always stop with line Killed at end.

Loading pygmalion-6b...
Killed

I tried to do it again with 8bits that is python server.py --load-in-8bit

But still same thing,

Loading pygmalion-6b...

===================================BUG REPORT===================================
Welcome to bitsandbytes. For bug reports, please submit your error trace to: https://github.com/TimDettmers/bitsandbytes/issues
For effortless bug reporting copy-paste your error into this form: https://docs.google.com/forms/d/e/1FAIpQLScPB8emS3Thkp66nvqwmjTEgxp8Y9ufuWTzFyr9kJ5AoI47dQ/viewform?usp=sf_link
================================================================================
CUDA SETUP: CUDA runtime path found: /home/denny/anaconda3/envs/textgen/lib/libcudart.so
CUDA SETUP: Highest compute capability among GPUs detected: 8.6
CUDA SETUP: Detected CUDA version 117
CUDA SETUP: Loading binary /home/denny/anaconda3/envs/textgen/lib/python3.10/site-packages/bitsandbytes/libbitsandbytes_cuda117.so...
Killed

It's not giving any error, I'm not having any idea why it is happening, Is this somehow related to me using WSL2?

API docs?

Would love to use this instead of kobold as an API + gui (kobold seems to be broken when trying to use pygmalion6b model)

Feature request for api docs like kobold has, if there is not one already :) Great work on this! https://koboldai.net/api

OSError: [Errno 36] File name too long

python3 server.py --cpu --cpu-memory 11 --disk --disk-cache-dir /home/ytpk/test/cach/ --cai-chat --listen --model pygmalion-2.7b --no-stream
2023-01-27 07:13:48.400788: I tensorflow/core/platform/cpu_feature_guard.cc:193] This TensorFlow binary is optimized with oneAPI Deep Neural Network Library (oneDNN) to use the following CPU instructions in performance-critical operations: SSE3 SSE4.1 SSE4.2 AVX AVX2 FMA
To enable them in other operations, rebuild TensorFlow with the appropriate compiler flags.
Loading pygmalion-2.7b...
Loaded the model in 83.87 seconds.
Traceback (most recent call last):
File "/mnt/sdb3/games/text-generation-webui/server.py", line 513, in
with gr.Blocks(css=css+".h-[40vh] {height: 66.67vh} .gradio-container {max-width: 800px; margin-left: auto; margin-right: auto}", analytics_enabled=False) as interface:
File "/home/ytpk/.local/lib/python3.10/site-packages/gradio/blocks.py", line 473, in init
if css is not None and Path(css).exists():
File "/usr/lib/python3.10/pathlib.py", line 1290, in exists
self.stat()
File "/usr/lib/python3.10/pathlib.py", line 1097, in stat
return self._accessor.stat(self, follow_symlinks=follow_symlinks)
OSError: [Errno 36] File name too long: '.my-4 {margin-top: 0} .py-6 {padding-top: 2.5rem} #refresh-button {flex: none; margin: 0; padding: 0; min-width: 50px; border: none; box-shadow: none; border-radius: 0} #download-label, #upload-label {min-height: 0}.h-\[40vh\] {height: 66.67vh} .gradio-container {max-width: 800px; margin-left: auto; margin-right: auto}'

Add option to set use_cache=False when loading model to save on VRAM

I used to get a lot of CUDA out-of-memory errors when generating text, until I added use_cache=False to the AutoModelForCausalLM.from_pretrained call.

Maybe it's placebo, but now it feels like if a model loads at all, it'll generate no problem.

Additionally, with a transformers patch to allow 8bit models to be split (huggingface/transformers#20281 (comment)), I can use gpt-neox-20b with only 8GiB of VRAM (and over 32GiB of system RAM), generating a token once every 6-7 seconds (54s/it with the new 8-token stream). Still slow, but it avoids disk cache so it's an improvement for me.

Manual VRAM/RAM layer adjustment

Currently when I try to load a large model with the intention of using auto devices to split it across VRAM and system RAM, the model may load in successfully but crash as soon as I actually try to generate something due to not enough VRAM. It would be good if either the manual distribution of the model across VRAM/RAM was easier/more accessible like in KoboldAI or if the automatic splitting was just more accurate.

Break models into pieces / safetensors support / keep session state

  • Implement a mechanic to sync conversation and panel state between all devices connected to the gradio link.

  • Add option (or another python file) to convert pytorch to safetensor (and make it not require that much ram...) - it loads faster, could load in-place when using disk cache (aka no need to extract model and add a bunch of writes to disk), and is safe from pickles. Convogpt is currently the only model using it.

  • Support resharding models into smaller pieces using ram/nvme offload.

Error when saving dialogue

Following the stuff added by the ER yesterday #50.
Starting parameters : --cai-chat --auto-devices --no-stream --bf16
OS : WIn10
Browser : Brave

I tried to save a story and all I get is this error :

Traceback (most recent call last):
File "C:\Users\USER\miniconda3\envs\textgen\lib\site-packages\gradio\routes.py", line 321, in run_predict
output = await app.blocks.process_api(
File "C:\Users\USER\miniconda3\envs\textgen\lib\site-packages\gradio\blocks.py", line 1015, in process_api
result = await self.call_function(fn_index, inputs, iterator, request)
File "C:\Users\USER\miniconda3\envs\textgen\lib\site-packages\gradio\blocks.py", line 856, in call_function
prediction = await anyio.to_thread.run_sync(
File "C:\Users\USER\miniconda3\envs\textgen\lib\site-packages\anyio\to_thread.py", line 31, in run_sync
return await get_asynclib().run_sync_in_worker_thread(
File "C:\Users\USER\miniconda3\envs\textgen\lib\site-packages\anyio_backends_asyncio.py", line 937, in run_sync_in_worker_thread
return await future
File "C:\Users\USER\miniconda3\envs\textgen\lib\site-packages\anyio_backends_asyncio.py", line 867, in run
result = context.run(func, *args)
File "D:\text-generation-webui\server.py", line 570, in save_history
with open(Path(f'logs/{fname}'), 'w') as f:
OSError: [Errno 22] Invalid argument: 'logs\Example_20230204-21:44:29.json'

8bit mode on older GPUs to reduce the VRAM usage by half

EDIT2: It gives this error while generating now: 0%| | 0/26 [00:00<?, ?it/s]cuBLAS API failed with status 15
error detectedA: torch.Size([50, 2560]), B: torch.Size([2560, 2560]), C: (50, 2560); (lda, ldb, ldc): (c_long(1600), c_long(81920), c_long(1600)); (m, n, k): (c_long(50), c_long(2560), c_long(2560))
0%| | 0/26 [00:00<?, ?it/s]
Traceback (most recent call last):
File "C:\Users\Siddhesh\miniconda3\envs\textgen\lib\site-packages\gradio\routes.py", line 321, in run_predict
output = await app.blocks.process_api(
File "C:\Users\Siddhesh\miniconda3\envs\textgen\lib\site-packages\gradio\blocks.py", line 1015, in process_api
result = await self.call_function(fn_index, inputs, iterator, request)
File "C:\Users\Siddhesh\miniconda3\envs\textgen\lib\site-packages\gradio\blocks.py", line 868, in call_function
prediction = await anyio.to_thread.run_sync(
File "C:\Users\Siddhesh\miniconda3\envs\textgen\lib\site-packages\anyio\to_thread.py", line 31, in run_sync
return await get_asynclib().run_sync_in_worker_thread(
File "C:\Users\Siddhesh\miniconda3\envs\textgen\lib\site-packages\anyio_backends_asyncio.py", line 937, in run_sync_in_worker_thread
return await future
File "C:\Users\Siddhesh\miniconda3\envs\textgen\lib\site-packages\anyio_backends_asyncio.py", line 867, in run
result = context.run(func, *args)
File "C:\Users\Siddhesh\miniconda3\envs\textgen\lib\site-packages\gradio\utils.py", line 408, in async_iteration
return next(iterator)
File "C:\Users\Siddhesh\Desktop\text-generation-webui\server.py", line 426, in cai_chatbot_wrapper
for _history in chatbot_wrapper(text, tokens, inference_settings, selected_model, name1, name2, context, check, history_size):
File "C:\Users\Siddhesh\Desktop\text-generation-webui\server.py", line 404, in chatbot_wrapper
for reply in generate_reply(question, tokens, inference_settings, selected_model, eos_token=eos_token, stopping_string=f"\n{name1}:"):
File "C:\Users\Siddhesh\Desktop\text-generation-webui\server.py", line 217, in generate_reply
output = eval(f"model.generate(input_ids, eos_token_id={n}, stopping_criteria=stopping_criteria_list, {preset}){cuda}")
File "", line 1, in
File "C:\Users\Siddhesh\miniconda3\envs\textgen\lib\site-packages\torch\autograd\grad_mode.py", line 27, in decorate_context
return func(*args, **kwargs)
File "C:\Users\Siddhesh\miniconda3\envs\textgen\lib\site-packages\transformers\generation\utils.py", line 1571, in generate
return self.sample(
File "C:\Users\Siddhesh\miniconda3\envs\textgen\lib\site-packages\transformers\generation\utils.py", line 2534, in sample
outputs = self(
File "C:\Users\Siddhesh\miniconda3\envs\textgen\lib\site-packages\torch\nn\modules\module.py", line 1194, in _call_impl
return forward_call(*input, **kwargs)
File "C:\Users\Siddhesh\miniconda3\envs\textgen\lib\site-packages\accelerate\hooks.py", line 156, in new_forward
output = old_forward(*args, **kwargs)
File "C:\Users\Siddhesh\miniconda3\envs\textgen\lib\site-packages\transformers\models\gpt_neo\modeling_gpt_neo.py", line 744, in forward
transformer_outputs = self.transformer(
File "C:\Users\Siddhesh\miniconda3\envs\textgen\lib\site-packages\torch\nn\modules\module.py", line 1194, in _call_impl
return forward_call(*input, **kwargs)
File "C:\Users\Siddhesh\miniconda3\envs\textgen\lib\site-packages\accelerate\hooks.py", line 156, in new_forward
output = old_forward(*args, **kwargs)
File "C:\Users\Siddhesh\miniconda3\envs\textgen\lib\site-packages\transformers\models\gpt_neo\modeling_gpt_neo.py", line 623, in forward
outputs = block(
File "C:\Users\Siddhesh\miniconda3\envs\textgen\lib\site-packages\torch\nn\modules\module.py", line 1194, in _call_impl
return forward_call(*input, **kwargs)
File "C:\Users\Siddhesh\miniconda3\envs\textgen\lib\site-packages\accelerate\hooks.py", line 156, in new_forward
output = old_forward(*args, **kwargs)
File "C:\Users\Siddhesh\miniconda3\envs\textgen\lib\site-packages\transformers\models\gpt_neo\modeling_gpt_neo.py", line 328, in forward
attn_outputs = self.attn(
File "C:\Users\Siddhesh\miniconda3\envs\textgen\lib\site-packages\torch\nn\modules\module.py", line 1194, in _call_impl
return forward_call(*input, **kwargs)
File "C:\Users\Siddhesh\miniconda3\envs\textgen\lib\site-packages\accelerate\hooks.py", line 156, in new_forward
output = old_forward(*args, **kwargs)
File "C:\Users\Siddhesh\miniconda3\envs\textgen\lib\site-packages\transformers\models\gpt_neo\modeling_gpt_neo.py", line 280, in forward
return self.attention(
File "C:\Users\Siddhesh\miniconda3\envs\textgen\lib\site-packages\torch\nn\modules\module.py", line 1194, in _call_impl
return forward_call(*input, **kwargs)
File "C:\Users\Siddhesh\miniconda3\envs\textgen\lib\site-packages\accelerate\hooks.py", line 156, in new_forward
output = old_forward(*args, **kwargs)
File "C:\Users\Siddhesh\miniconda3\envs\textgen\lib\site-packages\transformers\models\gpt_neo\modeling_gpt_neo.py", line 224, in forward
query = self.q_proj(hidden_states)
File "C:\Users\Siddhesh\miniconda3\envs\textgen\lib\site-packages\torch\nn\modules\module.py", line 1194, in _call_impl
return forward_call(*input, **kwargs)
File "C:\Users\Siddhesh\miniconda3\envs\textgen\lib\site-packages\accelerate\hooks.py", line 156, in new_forward
output = old_forward(*args, **kwargs)
File "C:\Users\Siddhesh\miniconda3\envs\textgen\lib\site-packages\bitsandbytes\nn\modules.py", line 254, in forward
out = bnb.matmul(x, self.weight, bias=self.bias, state=self.state)
File "C:\Users\Siddhesh\miniconda3\envs\textgen\lib\site-packages\bitsandbytes\autograd_functions.py", line 405, in matmul
return MatMul8bitLt.apply(A, B, out, bias, state)
File "C:\Users\Siddhesh\miniconda3\envs\textgen\lib\site-packages\bitsandbytes\autograd_functions.py", line 311, in forward
out32, Sout32 = F.igemmlt(C32A, state.CxB, SA, state.SB)
File "C:\Users\Siddhesh\miniconda3\envs\textgen\lib\site-packages\bitsandbytes\functional.py", line 1410, in igemmlt
raise Exception('cublasLt ran into an error!')
Exception: cublasLt ran into an error!

EDIT: I managed to get it to work! This helped me further: https://github.com/oobabooga/text-generation-webui/issues/20#issuecomment-1411650652

Pygmalion 2.7B used to take around 5.9 GB VRAM out of my 6GB GTX 1060 but now it takes 3.8GB VRAM ( Out of which 0.4 is prolly being used by the system as I don't have inbuilt graphics ) only!!! I'll try to see if I can fit Pygmalion 6B on my 6GB VRAM + 16 GB RAM + NVME.

https://github.com/james-things/bitsandbytes-prebuilt-all_arch

^^ "This repository contains builds of the bitsandbytes library compiled with the "all" option for GPU architecture support. They are useful if you are running into issues running bitsandbytes on older Nvidia GPUs. In theory, support exists for Kepler, Maxwell, Pascal, Volta, and newer GPUs."

It personally works for me in training LoRA using Kohya's scripts. I have a GTX 1060 6GB which does not natively support it but it is able to train fine when I use these prebuilt bitsandbytes.

https://github.com/kohya-ss/sd-scripts/issues/44#issuecomment-1375690372 I tried to do the same steps here which worked for me previously but since i'm not a coder as such, I'm having difficulties implementing it.

Server.py start-up error with "Torch not compiled with CUDA enabled"

I had finished the installation progress without any notable errors and warnings, but I face an unexpected error when I execute the command python server.py even though I installed PyTorch and related packages at step 3 in the installation procedure.

Do you have any ideas? Here are my environment specification and error log. I'm trying to run pygmalion model with your project.

spec

(I'm using laptop)
CPU : 12th Gen Intel(R) Core(TM) i9-12900H
RAM : 64GB
Disk : 1TB SSD / 2TB SSD
GPU : Intel(R) Iris(R) Xe Graphics / NVIDIA GeForce RTX 3080 Laptop GPU (TGP 150W)

Error log

(textgen) PS D:\PygmalionProj\text-generation-webui> python server.py
Loading pygmalion-6b...
Traceback (most recent call last):
  File "D:\PygmalionProj\text-generation-webui\server.py", line 211, in <module>
    model, tokenizer = load_model(model_name)
  File "D:\PygmalionProj\text-generation-webui\server.py", line 78, in load_model
    model = AutoModelForCausalLM.from_pretrained(Path(f"models/{model_name}"), low_cpu_mem_usage=True, torch_dtype=torch.float16).cuda()
  File "C:\Users\3NR1QUE\AppData\Roaming\Python\Python310\site-packages\torch\nn\modules\module.py", line 749, in cuda
    return self._apply(lambda t: t.cuda(device))
  File "C:\Users\3NR1QUE\AppData\Roaming\Python\Python310\site-packages\torch\nn\modules\module.py", line 641, in _apply
    module._apply(fn)
  File "C:\Users\3NR1QUE\AppData\Roaming\Python\Python310\site-packages\torch\nn\modules\module.py", line 641, in _apply
    module._apply(fn)
  File "C:\Users\3NR1QUE\AppData\Roaming\Python\Python310\site-packages\torch\nn\modules\module.py", line 664, in _apply
    param_applied = fn(param)
  File "C:\Users\3NR1QUE\AppData\Roaming\Python\Python310\site-packages\torch\nn\modules\module.py", line 749, in <lambda>
    return self._apply(lambda t: t.cuda(device))
  File "C:\Users\3NR1QUE\AppData\Roaming\Python\Python310\site-packages\torch\cuda\__init__.py", line 221, in _lazy_init
    raise AssertionError("Torch not compiled with CUDA enabled")
AssertionError: Torch not compiled with CUDA enabled

In my case, NVIDIA Cuda compiler driver has been installed successfully.

(textgen) PS D:\PygmalionProj\text-generation-webui> nvcc --version
nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2022 NVIDIA Corporation
Built on Wed_Jun__8_16:59:34_Pacific_Daylight_Time_2022
Cuda compilation tools, release 11.7, V11.7.99
Build cuda_11.7.r11.7/compiler.31442593_0

But when I check if torch.cuda.is_available() prints True that means cuda is in operation, it prints False even though every required packages has been installed completely.

(textgen) PS D:\PygmalionProj\text-generation-webui> python
Python 3.10.9 | packaged by conda-forge | (main, Jan 11 2023, 15:15:40) [MSC v.1916 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import torch
>>> torch.cuda.is_available()
False

Do you have any ideas about what I have to do to solve this problem and run text-generation-webui properly?
And any help related to these would be thankful!

[Feature Request] Add disk cache and Token streaming

Hi, thanks for making this app! I have some ideas of further improvement.

Although my computer possesses 32GB of memory and 8GB of VRAM, experiments still indicated that these are not enough to load the 13b models. It would be a great help to add disk cache function so larger models could load. Ideally, I would love the cache to be generated once-and-for-all (generate once and reads the generated cache the next time instead of re-generating), so I don't have to push too much load on my ssd, but that's just an extra request.

For Token streaming, it would be a great help to add token streaming (displays token while they are being generated) into this app since many people (like me) are not very patient with the AI. The generation time could go up to minutes and it would be helpful to directly view the generating text.

Just some thoughts about adding features to this program.

Implement ZeRO inference

Some information
Seems like ZeRO inference could improve the performance of offloading to RAM/NVMe. I don't know if huggingface's accelerate is already using it, but if not, it would be a great feature to add.

Deepspeed Error on Windows - LINK : fatal error LNK1181: cannot open input file 'aio.lib'

(textgen) C:\Users\Siddhesh\Desktop\text-generation-webui>pip install -r requirements.txt
Collecting accelerate==0.15.0
Using cached accelerate-0.15.0-py3-none-any.whl (191 kB)
Collecting bitsandbytes==0.36.0.post2
Using cached bitsandbytes-0.36.0.post2-py3-none-any.whl (76.3 MB)
Collecting deepspeed==0.8.0
Using cached deepspeed-0.8.0.tar.gz (749 kB)
Preparing metadata (setup.py) ... error
error: subprocess-exited-with-error

ร— python setup.py egg_info did not run successfully.
โ”‚ exit code: 1
โ•ฐโ”€> [15 lines of output]
test.c
LINK : fatal error LNK1181: cannot open input file 'aio.lib'
Traceback (most recent call last):
File "", line 2, in
File "", line 34, in
File "C:\Users\Siddhesh\AppData\Local\Temp\pip-install-plr1qrri\deepspeed_02a1e689bf514f02a58b413d2ee0b723\setup.py", line 156, in
abort(f"Unable to pre-compile {op_name}")
File "C:\Users\Siddhesh\AppData\Local\Temp\pip-install-plr1qrri\deepspeed_02a1e689bf514f02a58b413d2ee0b723\setup.py", line 48, in abort
assert False, msg
AssertionError: Unable to pre-compile async_io
DS_BUILD_OPS=1
[WARNING] async_io requires the dev libaio .so object and headers but these were not found.
[WARNING] If libaio is already installed (perhaps from source), try setting the CFLAGS and LDFLAGS environment variables to where it can be found.
[WARNING] One can disable async_io with DS_BUILD_AIO=0
[ERROR] Unable to pre-compile async_io
[end of output]

note: This error originates from a subprocess, and is likely not a problem with pip.
error: metadata-generation-failed

ร— Encountered error while generating package metadata.
โ•ฐโ”€> See above for output.

note: This is an issue with the package mentioned above, not pip.
hint: See above for details.

8-bit precision not working on Windows

It seems like it doesn't like to work on Windows and is unable to detect my cuda installation.

(textgen) C:\Users\pasil\text-generation-webui>python server.py --cai-chat --load-in-8bit
Warning: chat mode currently becomes a lot slower with text streaming on.
Consider starting the web UI with the --no-stream option.

Loading pygmalion-6b_dev...

===================================BUG REPORT===================================
Welcome to bitsandbytes. For bug reports, please submit your error trace to: https://github.com/TimDettmers/bitsandbytes/issues
For effortless bug reporting copy-paste your error into this form: https://docs.google.com/forms/d/e/1FAIpQLScPB8emS3Thkp66nvqwmjTEgxp8Y9ufuWTzFyr9kJ5AoI47dQ/viewform?usp=sf_link
================================================================================
C:\Users\pasil\anaconda3\envs\textgen\lib\site-packages\bitsandbytes\cuda_setup\main.py:134: UserWarning: WARNING: The following directories listed in your path were found to be non-existent: {WindowsPath('C')}
  warn(msg)
C:\Users\pasil\anaconda3\envs\textgen\lib\site-packages\bitsandbytes\cuda_setup\main.py:134: UserWarning: C:\Users\pasil\anaconda3\envs\textgen did not contain libcudart.so as expected! Searching further paths...
  warn(msg)
CUDA_SETUP: WARNING! libcudart.so not found in any environmental path. Searching /usr/local/cuda/lib64...
C:\Users\pasil\anaconda3\envs\textgen\lib\site-packages\bitsandbytes\cuda_setup\main.py:134: UserWarning: WARNING: The following directories listed in your path were found to be non-existent: {WindowsPath('/usr/local/cuda/lib64')}
  warn(msg)
CUDA SETUP: WARNING! libcuda.so not found! Do you have a CUDA driver installed? If you are on a cluster, make sure you are on a CUDA machine!
C:\Users\pasil\anaconda3\envs\textgen\lib\site-packages\bitsandbytes\cuda_setup\main.py:134: UserWarning: WARNING: No libcudart.so found! Install CUDA or the cudatoolkit package (anaconda)!
  warn(msg)
C:\Users\pasil\anaconda3\envs\textgen\lib\site-packages\bitsandbytes\cuda_setup\main.py:134: UserWarning: WARNING: No GPU detected! Check your CUDA paths. Proceeding to load CPU-only library...
  warn(msg)
CUDA SETUP: Loading binary C:\Users\pasil\anaconda3\envs\textgen\lib\site-packages\bitsandbytes\libbitsandbytes_cpu.so...
argument of type 'WindowsPath' is not iterable
CUDA_SETUP: WARNING! libcudart.so not found in any environmental path. Searching /usr/local/cuda/lib64...
CUDA SETUP: WARNING! libcuda.so not found! Do you have a CUDA driver installed? If you are on a cluster, make sure you are on a CUDA machine!
CUDA SETUP: Loading binary C:\Users\pasil\anaconda3\envs\textgen\lib\site-packages\bitsandbytes\libbitsandbytes_cpu.so...
argument of type 'WindowsPath' is not iterable
CUDA_SETUP: WARNING! libcudart.so not found in any environmental path. Searching /usr/local/cuda/lib64...
CUDA SETUP: WARNING! libcuda.so not found! Do you have a CUDA driver installed? If you are on a cluster, make sure you are on a CUDA machine!
CUDA SETUP: Loading binary C:\Users\pasil\anaconda3\envs\textgen\lib\site-packages\bitsandbytes\libbitsandbytes_cpu.so...
argument of type 'WindowsPath' is not iterable
CUDA SETUP: Problem: The main issue seems to be that the main CUDA library was not detected.
CUDA SETUP: Solution 1): Your paths are probably not up-to-date. You can update them via: sudo ldconfig.
CUDA SETUP: Solution 2): If you do not have sudo rights, you can do the following:
CUDA SETUP: Solution 2a): Find the cuda library via: find / -name libcuda.so 2>/dev/null
CUDA SETUP: Solution 2b): Once the library is found add it to the LD_LIBRARY_PATH: export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:FOUND_PATH_FROM_2a
CUDA SETUP: Solution 2c): For a permanent solution add the export from 2b into your .bashrc file, located at ~/.bashrc
Traceback (most recent call last):
  File "C:\Users\pasil\text-generation-webui\server.py", line 235, in <module>
    model, tokenizer = load_model(model_name)
  File "C:\Users\pasil\text-generation-webui\server.py", line 109, in load_model
    model = eval(command)
  File "<string>", line 1, in <module>
  File "C:\Users\pasil\anaconda3\envs\textgen\lib\site-packages\transformers\models\auto\auto_factory.py", line 463, in from_pretrained
    return model_class.from_pretrained(
  File "C:\Users\pasil\anaconda3\envs\textgen\lib\site-packages\transformers\modeling_utils.py", line 2279, in from_pretrained
    from .utils.bitsandbytes import get_keys_to_not_convert, replace_8bit_linear
  File "C:\Users\pasil\anaconda3\envs\textgen\lib\site-packages\transformers\utils\bitsandbytes.py", line 10, in <module>
    import bitsandbytes as bnb
  File "C:\Users\pasil\anaconda3\envs\textgen\lib\site-packages\bitsandbytes\__init__.py", line 7, in <module>
    from .autograd._functions import (
  File "C:\Users\pasil\anaconda3\envs\textgen\lib\site-packages\bitsandbytes\autograd\_functions.py", line 8, in <module>
    import bitsandbytes.functional as F
  File "C:\Users\pasil\anaconda3\envs\textgen\lib\site-packages\bitsandbytes\functional.py", line 17, in <module>
    from .cextension import COMPILED_WITH_CUDA, lib
  File "C:\Users\pasil\anaconda3\envs\textgen\lib\site-packages\bitsandbytes\cextension.py", line 22, in <module>
    raise RuntimeError('''
RuntimeError:
        CUDA Setup failed despite GPU being available. Inspect the CUDA SETUP outputs above to fix your environment!
        If you cannot find any issues and suspect a bug, please open an issue with detals about your environment:
        https://github.com/TimDettmers/bitsandbytes/issues

Token count

Hello,
I was curious there, but I don't see it anywhere, so I wanted to ask: is there any way to check on how many tokens each input/outpu takes from the chat UI?

Cannot run the 4chan model

"OSError: models/gpt-4chan does not appear to have a file named config.json."

Is there anywhere I can find the json for it?

Suggestions for a faster response?

Hello!

I wondering if you have any tips for a faster response, it takes about a minute for my characters. Thank you!

This is what I'm running the script with
python server.py --cai-chat --auto-devices --gpu-memory 6 --no-stream

missing 4 python modules

I had to install 4 python modules.
pip install transformers accelerate gradio torch
Other than that works great

one server, multiple sessions (users) ((feature request))

Hey guys,

First of all, thanks a bunch for working on this project, I'm following closely. Hoping I can contribute with something one day.

My question is: Is there a way to run non-shared sessions using a single instance? When I shared my instance on the local network, chat-history was present on multiple computers at a point, they were both using the same character.

I suppose the most obvious technical challenge would be the fast-switch of context and history especially if two users are talking to two different characters.

Thank you!

wiki error

the wiki says to name you profile picture: "img_you.png", this doesn't work and the correct thing would be "img_me.png".

Add a easy start script

automatic1111 has a useful bash script that sets everything up easily and starts it with just one command ./webui.sh it would be nice if this had something similar

Error on Text Generation Related to Memory Management

Was able to load the Pygmalion-6b model and even got a few lines of text back and forth before I hit an error and got the below text in the Anaconda Powershell Prompt:

  File "C:\Users\Zach\miniconda3\envs\textgen\lib\site-packages\gradio\routes.py", line 321, in run_predict
    output = await app.blocks.process_api(
  File "C:\Users\Zach\miniconda3\envs\textgen\lib\site-packages\gradio\blocks.py", line 1006, in process_api
    result = await self.call_function(fn_index, inputs, iterator, request)
  File "C:\Users\Zach\miniconda3\envs\textgen\lib\site-packages\gradio\blocks.py", line 847, in call_function
    prediction = await anyio.to_thread.run_sync(
  File "C:\Users\Zach\miniconda3\envs\textgen\lib\site-packages\anyio\to_thread.py", line 31, in run_sync
    return await get_asynclib().run_sync_in_worker_thread(
  File "C:\Users\Zach\miniconda3\envs\textgen\lib\site-packages\anyio\_backends\_asyncio.py", line 937, in run_sync_in_worker_thread
    return await future
  File "C:\Users\Zach\miniconda3\envs\textgen\lib\site-packages\anyio\_backends\_asyncio.py", line 867, in run
    result = context.run(func, *args)
  File "I:\text-generation-webui\server.py", line 245, in cai_chatbot_wrapper
    history = chatbot_wrapper(text, tokens, inference_settings, selected_model, name1, name2, context, check)
  File "I:\text-generation-webui\server.py", line 231, in chatbot_wrapper
    reply = generate_reply(question, tokens, inference_settings, selected_model, eos_token='\n')[0]
  File "I:\text-generation-webui\server.py", line 149, in generate_reply
    output = eval(f"model.generate(input_ids, eos_token_id={n}, {preset}){cuda}")
  File "<string>", line 1, in <module>
  File "C:\Users\Zach\miniconda3\envs\textgen\lib\site-packages\torch\autograd\grad_mode.py", line 27, in decorate_context
    return func(*args, **kwargs)
  File "C:\Users\Zach\miniconda3\envs\textgen\lib\site-packages\transformers\generation\utils.py", line 1571, in generate
    return self.sample(
  File "C:\Users\Zach\miniconda3\envs\textgen\lib\site-packages\transformers\generation\utils.py", line 2534, in sample
    outputs = self(
  File "C:\Users\Zach\miniconda3\envs\textgen\lib\site-packages\torch\nn\modules\module.py", line 1194, in _call_impl
    return forward_call(*input, **kwargs)
  File "C:\Users\Zach\miniconda3\envs\textgen\lib\site-packages\accelerate\hooks.py", line 156, in new_forward
    output = old_forward(*args, **kwargs)
  File "C:\Users\Zach\miniconda3\envs\textgen\lib\site-packages\transformers\models\gptj\modeling_gptj.py", line 844, in forward
    lm_logits = self.lm_head(hidden_states).to(torch.float32)
  File "C:\Users\Zach\miniconda3\envs\textgen\lib\site-packages\torch\nn\modules\module.py", line 1194, in _call_impl
    return forward_call(*input, **kwargs)
  File "C:\Users\Zach\miniconda3\envs\textgen\lib\site-packages\accelerate\hooks.py", line 151, in new_forward
    args, kwargs = module._hf_hook.pre_forward(module, *args, **kwargs)
  File "C:\Users\Zach\miniconda3\envs\textgen\lib\site-packages\accelerate\hooks.py", line 264, in pre_forward
    set_module_tensor_to_device(module, name, self.execution_device, value=self.weights_map[name])
  File "C:\Users\Zach\miniconda3\envs\textgen\lib\site-packages\accelerate\utils\modeling.py", line 123, in set_module_tensor_to_device
    new_value = value.to(device)
torch.cuda.OutOfMemoryError: CUDA out of memory. Tried to allocate 394.00 MiB (GPU 0; 8.00 GiB total capacity; 6.37 GiB already allocated; 0 bytes free; 6.77 GiB reserved in total by PyTorch) If reserved memory is >> allocated memory try setting max_split_size_mb to avoid fragmentation.  See documentation for Memory Management and PYTORCH_CUDA_ALLOC_CONF```

Server started with command ```python server.py --cai-chat --model pygmalion-6b --auto-devices```

System specs are
Processor: i7-11700k
Graphics: GTX-1080, 8GB vRam
RAM: 32GB ram
OS: Windows 10 Enterprise LTSC

My understanding was --auto-devices would split the ram needs up so as to not need the expected amount of vRAM since clearly my card doesn't have enough. If I was wrong about what the --auto-devices command does please close this issue.

Issue partitioning memory between GPU and CPU (--auto-device not working)

Untitled

The above error is what I get when I try to use --auto-device to split between GPU and CPU. The system has 128GB of ram and a 4090, I've tried variations such as preallocating a certain amount of CPU memory and GPU memory, and I keep getting the attached error.

I like the UI and would love to get this to work, also 8-bit is not working, but I figured one issue at a time. KoboldAI is good, but I think this runs faster and the outputs are easier to read.

Are Radeon GPUs supported?

I'm getting "hipErrorNoBinaryForGpu: Unable to find code object for all current devices!" even with torch* set to +rocm5.2

Error when trying to limit GPU memory

C:\text-generation-webui>python server.py --model PygmalionAI_pygmalion-2.7b --gpu-memory 5 --cai-chat --no-stream --listen &
Loading PygmalionAI_pygmalion-2.7b...
Traceback (most recent call last):
File "C:\text-generation-webui\server.py", line 284, in
model, tokenizer = load_model(model_name)
File "C:\text-generation-webui\server.py", line 113, in load_model
model = eval(command)
File "", line 1, in
File "C:\Users(name)\AppData\Local\Programs\Python\Python310\lib\site-packages\transformers\models\auto\auto_factory.py", line 446, in from_pretrained
return model_class.from_pretrained(pretrained_model_name_or_path, *model_args, config=config, **kwargs)
File "C:\Users(name)\AppData\Local\Programs\Python\Python310\lib\site-packages\transformers\modeling_utils.py", line 2024, in from_pretrained
model = cls(config, *model_args, **model_kwargs)
TypeError: GPTNeoForCausalLM.init() got an unexpected keyword argument 'device_map'

Error when using --load-in-8bit: no kernel image is available for execution on the device

I've been trying to load Pyg 2.7B model in 8-bit mode using my GTX 980ti on Windows 10, I am aware 8-bit mode is not really supported on pascal and older cards, though I have seen some people be able to do it. I followed #20 (comment), and I was able to get rid of the 'CUDA Setup failed despite GPU being available.' error I had earlier, however a new one arose, here is the log:

(textgen) C:\Users\Admin\text-generation-webui>python server.py --load-in-8bit --cai-chat --no-stream
Loading pygmalion-2.7b...

===================================BUG REPORT===================================
Welcome to bitsandbytes. For bug reports, please submit your error trace to: https://github.com/TimDettmers/bitsandbytes/issues
================================================================================
Error no kernel image is available for execution on the device at line 479 in file D:\ai\tool\bitsandbytes\csrc\ops.cu

Any idea on how to solve this issue?

8-bit mode on older GPUs

When running python server.py --load-in-8bit --auto-devices it crashes with this, perhaps this related to a dependency?

(textgen)
text-generation-webui on ๎‚  main [?] via ๐Ÿ v3.10.9 via ๐Ÿ…’ textgen took 33m49s
โฏ python server.py --load-in-8bit --auto-devices
Loading gpt-j-6B...

===================================BUG REPORT===================================
Welcome to bitsandbytes. For bug reports, please submit your error trace to: https://github.com/TimDettmers/bitsandbytes/issues
For effortless bug reporting copy-paste your error into this form: https://docs.google.com/forms/d/e/1FAIpQLScPB8emS3Thkp66nvqwmjTEgxp8Y9ufuWTzFyr9kJ5AoI47dQ/viewform?usp=sf_link
================================================================================
Traceback (most recent call last):
  File "/home/noah/Documents/textgen/text-generation-webui/server.py", line 367, in <module>
    model, tokenizer = load_model(model_name)
  File "/home/noah/Documents/textgen/text-generation-webui/server.py", line 151, in load_model
    model = eval(command)
  File "<string>", line 1, in <module>
  File "/home/noah/.conda/envs/textgen/lib/python3.10/site-packages/transformers/models/auto/auto_factory.py", line 463, in from_pretrained
    return model_class.from_pretrained(
  File "/home/noah/.conda/envs/textgen/lib/python3.10/site-packages/transformers/modeling_utils.py", line 2279, in from_pretrained
    from .utils.bitsandbytes import get_keys_to_not_convert, replace_8bit_linear
  File "/home/noah/.conda/envs/textgen/lib/python3.10/site-packages/transformers/utils/bitsandbytes.py", line 10, in <module>
    import bitsandbytes as bnb
  File "/home/noah/.conda/envs/textgen/lib/python3.10/site-packages/bitsandbytes/__init__.py", line 7, in <module>
    from .autograd._functions import (
  File "/home/noah/.conda/envs/textgen/lib/python3.10/site-packages/bitsandbytes/autograd/_functions.py", line 8, in <module>
    import bitsandbytes.functional as F
  File "/home/noah/.conda/envs/textgen/lib/python3.10/site-packages/bitsandbytes/functional.py", line 17, in <module>
    from .cextension import COMPILED_WITH_CUDA, lib
  File "/home/noah/.conda/envs/textgen/lib/python3.10/site-packages/bitsandbytes/cextension.py", line 13, in <module>
    setup.run_cuda_setup()
  File "/home/noah/.conda/envs/textgen/lib/python3.10/site-packages/bitsandbytes/cuda_setup/main.py", line 91, in run_cuda_setup
    binary_name, cudart_path, cuda, cc, cuda_version_string = evaluate_cuda_setup()
  File "/home/noah/.conda/envs/textgen/lib/python3.10/site-packages/bitsandbytes/cuda_setup/main.py", line 394, in evaluate_cuda_setup
    has_cublaslt = is_cublasLt_compatible(cc)
  File "/home/noah/.conda/envs/textgen/lib/python3.10/site-packages/bitsandbytes/cuda_setup/main.py", line 151, in is_cublasLt_compatible
    cuda_setup.add_log_entry("WARNING: Compute capability < 7.5 detected! Proceeding to load CPU-only library...", is_warning=True)
NameError: name 'cuda_setup' is not defined. Did you mean: 'CUDASetup'?
(textgen)
text-generation-webui on ๎‚  main [?] via ๐Ÿ v3.10.9 via ๐Ÿ…’ textgen took 15s
โฏ

System info

                   -`                    noah@noah-b450aorusprowifi
                  .o+`                   --------------------------
                 `ooo/                   OS: EndeavourOS Linux x86_64
                `+oooo:                  Host: B450 AORUS PRO WIFI
               `+oooooo:                 Kernel: 6.1.8-arch1-1
               -+oooooo+:                Uptime: 1 hour, 9 mins
             `/:-:++oooo+:               Packages: 993 (pacman), 35 (flatpak)
            `/++++/+++++++:              Shell: zsh 5.9
           `/++++++++++++++:             Resolution: 1920x1080
          `/+++ooooooooooooo/`           DE: Plasma 5.26.5
         ./ooosssso++osssssso+`          WM: KWin
        .oossssso-````/ossssss+`         WM Theme: Breeze
       -osssssso.      :ssssssso.        Theme: [Plasma], Breeze [GTK2/3]
      :osssssss/        osssso+++.       Icons: [Plasma], breeze-dark [GTK2/3]
     /ossssssss/        +ssssooo/-       Terminal: alacritty
   `/ossssso+/:-        -:/+osssso+-     Terminal Font: JetBrains Mono Nerd Font
  `+sso+:-`                 `.-/+oso:    CPU: AMD Ryzen 7 3700X (16) @ 3.600GHz
 `++:.                           `-/+/   GPU: NVIDIA GeForce GTX 1080
 .`                                 `/   Memory: 2738MiB / 32020MiB

Output of pygmalion-6b model doesn't terminate (?)

I tried using the example character and one of the example inputs from the Huggingface discussion, but for some reason, the current dev branch (SHA256 of pytorch_model-00001-of-00002.bin starts with a2401367) results in the output continuing indefinitely to fill the allowed tokens, and also doesn't make much sense either. This doesn't match the example in the Huggingface discussion, and I didn't see mention of it as a bug, so I'm not sure what the cause is. Example below.

Only command-line flag in use is --chat. The other versions of the model I tested (first commit and most recent on the main branch) don't have the issue, only the latest on the dev branch.

Error when using --load-in-8bit : RuntimeError: probability tensor contains either `inf`, `nan` or element < 0

(textgen) C:\Users\Siddhesh\Desktop\text-generation-webui>python server.py --load-in-8bit --cai-chat --no-stream
Loading pygmalion-2.7b...

===================================BUG REPORT===================================
Welcome to bitsandbytes. For bug reports, please submit your error trace to: https://github.com/TimDettmers/bitsandbytes/issues

Loaded the model in 5.64 seconds.
Running on local URL: http://127.0.0.1:7860

To create a public link, set share=True in launch().
Traceback (most recent call last):
File "C:\Users\Siddhesh\miniconda3\envs\textgen\lib\site-packages\gradio\routes.py", line 321, in run_predict
output = await app.blocks.process_api(
File "C:\Users\Siddhesh\miniconda3\envs\textgen\lib\site-packages\gradio\blocks.py", line 1015, in process_api
result = await self.call_function(fn_index, inputs, iterator, request)
File "C:\Users\Siddhesh\miniconda3\envs\textgen\lib\site-packages\gradio\blocks.py", line 868, in call_function
prediction = await anyio.to_thread.run_sync(
File "C:\Users\Siddhesh\miniconda3\envs\textgen\lib\site-packages\anyio\to_thread.py", line 31, in run_sync
return await get_asynclib().run_sync_in_worker_thread(
File "C:\Users\Siddhesh\miniconda3\envs\textgen\lib\site-packages\anyio_backends_asyncio.py", line 937, in run_sync_in_worker_thread
return await future
File "C:\Users\Siddhesh\miniconda3\envs\textgen\lib\site-packages\anyio_backends_asyncio.py", line 867, in run
result = context.run(func, *args)
File "C:\Users\Siddhesh\miniconda3\envs\textgen\lib\site-packages\gradio\utils.py", line 408, in async_iteration
return next(iterator)
File "C:\Users\Siddhesh\Desktop\text-generation-webui\server.py", line 465, in cai_chatbot_wrapper
for _history in chatbot_wrapper(text, tokens, inference_settings, selected_model, name1, name2, context, check, history_size):
File "C:\Users\Siddhesh\Desktop\text-generation-webui\server.py", line 443, in chatbot_wrapper
for reply in generate_reply(question, tokens, inference_settings, selected_model, eos_token=eos_token, stopping_string=f"\n{name1}:"):
File "C:\Users\Siddhesh\Desktop\text-generation-webui\server.py", line 242, in generate_reply
output = eval(f"model.generate(input_ids, {','.join(generate_params)}, {preset}){cuda}")
File "", line 1, in
File "C:\Users\Siddhesh\miniconda3\envs\textgen\lib\site-packages\torch\autograd\grad_mode.py", line 27, in decorate_context
return func(*args, **kwargs)
File "C:\Users\Siddhesh\miniconda3\envs\textgen\lib\site-packages\transformers\generation\utils.py", line 1571, in generate
return self.sample(
File "C:\Users\Siddhesh\miniconda3\envs\textgen\lib\site-packages\transformers\generation\utils.py", line 2570, in sample
next_tokens = torch.multinomial(probs, num_samples=1).squeeze(1)
RuntimeError: probability tensor contains either inf, nan or element < 0

`download-model.py` script not working

When I run the download-model.py script I get the following error repeated multiple times:

G:\Pygmalion\text-generation-webui>python download-model.py PygmalionAI/pygmalion-6b
Downloading the model to models\pygmalion-6b...
Downloading the model to models\pygmalion-6b...
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "C:\Users\Anon\AppData\Local\Programs\Python\Python310\lib\multiprocessing\spawn.py", line 116, in spawn_main
    exitcode = _main(fd, parent_sentinel)
  File "C:\Users\Anon\AppData\Local\Programs\Python\Python310\lib\multiprocessing\spawn.py", line 125, in _main
    prepare(preparation_data)
  File "C:\Users\Anon\AppData\Local\Programs\Python\Python310\lib\multiprocessing\spawn.py", line 236, in prepare
    _fixup_main_from_path(data['init_main_from_path'])
  File "C:\Users\Anon\AppData\Local\Programs\Python\Python310\lib\multiprocessing\spawn.py", line 287, in _fixup_main_from_path
    main_content = runpy.run_path(main_path,
  File "C:\Users\Anon\AppData\Local\Programs\Python\Python310\lib\runpy.py", line 269, in run_path
    return _run_module_code(code, init_globals, run_name,
  File "C:\Users\Anon\AppData\Local\Programs\Python\Python310\lib\runpy.py", line 96, in _run_module_code
    _run_code(code, mod_globals, init_globals,
  File "C:\Users\Anon\AppData\Local\Programs\Python\Python310\lib\runpy.py", line 86, in _run_code
    exec(code, run_globals)
  File "G:\Pygmalion\text-generation-webui\download-model.py", line 51, in <module>
    pool = multiprocessing.Pool(processes=4)
  File "C:\Users\Anon\AppData\Local\Programs\Python\Python310\lib\multiprocessing\context.py", line 119, in Pool
    return Pool(processes, initializer, initargs, maxtasksperchild,
  File "C:\Users\Anon\AppData\Local\Programs\Python\Python310\lib\multiprocessing\pool.py", line 212, in __init__
    self._repopulate_pool()
  File "C:\Users\Anon\AppData\Local\Programs\Python\Python310\lib\multiprocessing\pool.py", line 303, in _repopulate_pool
    return self._repopulate_pool_static(self._ctx, self.Process,
  File "C:\Users\Anon\AppData\Local\Programs\Python\Python310\lib\multiprocessing\pool.py", line 326, in _repopulate_pool_static
    w.start()
  File "C:\Users\Anon\AppData\Local\Programs\Python\Python310\lib\multiprocessing\process.py", line 121, in start
    self._popen = self._Popen(self)
  File "C:\Users\Anon\AppData\Local\Programs\Python\Python310\lib\multiprocessing\context.py", line 327, in _Popen
    return Popen(process_obj)
  File "C:\Users\Anon\AppData\Local\Programs\Python\Python310\lib\multiprocessing\popen_spawn_win32.py", line 45, in __init__
    prep_data = spawn.get_preparation_data(process_obj._name)
  File "C:\Users\Anon\AppData\Local\Programs\Python\Python310\lib\multiprocessing\spawn.py", line 154, in get_preparation_data
    _check_not_importing_main()
  File "C:\Users\Anon\AppData\Local\Programs\Python\Python310\lib\multiprocessing\spawn.py", line 134, in _check_not_importing_main
    raise RuntimeError('''
RuntimeError:
        An attempt has been made to start a new process before the
        current process has finished its bootstrapping phase.

        This probably means that you are not using fork to start your
        child processes and you have forgotten to use the proper idiom
        in the main module:

            if __name__ == '__main__':
                freeze_support()
                ...

        The "freeze_support()" line can be omitted if the program
        is not going to be frozen to produce an executable.

Error when generating using 8-bit mode: Illegal memory access

python server.py --cai-chat --no-stream --load-in-8bit
RTX 20xx, Windows 11 (8bit windows patch applied)

Screenshot at 06-02-38

When using flag CUDA_LAUNCH_BLOCKING=1:

Error an illegal memory access was encountered at line 479 in file D:\ai\tool\bitsandbytes\csrc\ops.cu

Pretty sure it's a problem in how libbitsandbytes dlls in

#20 (comment)

are compiled?

Offering additional new features in the web ui

I suggest adding a couple of useful features in my opinion to the web ui:

  1. The ability to restart the web ui with new parameters (for example --load-in-8 bit or --chat)

  2. Ability to change Presets parameters in real time in webui.
    (for example top_p,top_k,temperature,etc )

server.py doesn't seem to use DP/DDP for multi-GPU

I have 2 P100 for a total of 32GB VRAM. I'm attempting to load OPT-13B-Erebus. Server.py throws the following exception:

torch.cuda.OutOfMemoryError: CUDA out of memory. Tried to allocate 200.00 MiB (GPU 0; 15.89 GiB total capacity; 15.54 GiB already allocated; 35.88 MiB free; 15.54 GiB reserved in total by PyTorch) If reserved memory is >> allocated memory try setting max_split_size_mb to avoid fragmentation.  See documentation for Memory Management and PYTORCH_CUDA_ALLOC_CONF

nvidia-smi:

Tue Jan 10 04:51:24 2023       
+-----------------------------------------------------------------------------+
| NVIDIA-SMI 525.60.13    Driver Version: 525.60.13    CUDA Version: 12.0     |
|-------------------------------+----------------------+----------------------+
| GPU  Name        Persistence-M| Bus-Id        Disp.A | Volatile Uncorr. ECC |
| Fan  Temp  Perf  Pwr:Usage/Cap|         Memory-Usage | GPU-Util  Compute M. |
|                               |                      |               MIG M. |
|===============================+======================+======================|
|   0  Tesla P100-PCIE...  On   | 00000000:05:00.0 Off |                    0 |
| N/A   29C    P0    26W / 250W |      0MiB / 16384MiB |      0%      Default |
|                               |                      |                  N/A |
+-------------------------------+----------------------+----------------------+
|   1  Tesla P100-PCIE...  On   | 00000000:42:00.0 Off |                    0 |
| N/A   30C    P0    25W / 250W |      0MiB / 16384MiB |      0%      Default |
|                               |                      |                  N/A |
+-------------------------------+----------------------+----------------------+
                                                                               
+-----------------------------------------------------------------------------+
| Processes:                                                                  |
|  GPU   GI   CI        PID   Type   Process name                  GPU Memory |
|        ID   ID                                                   Usage      |
|=============================================================================|
|  No running processes found                                                 |
+-----------------------------------------------------------------------------+

'Send last reply to input' doesn't include formatting

Hi, I'm absolutely in love with the new 'Send last reply to input' and 'Replace last reply' features. I've been able to use them to get responses that were previously extremely difficult to spur on, and it's my favorite part of Ooba so far!

I have noticed that when I click the send last reply to input button, it doesn't include italics, bolds, etc that were included in the raw input. This means that if I want to edit a reply that has asterisks or etc formatting, I have to re-type all of those formatting pieces by hand. Would it be possible to make it so that the formatting is automatically included when you click that button?

Deepspeed error on WSL - exits with return code = -9

(textgen) siddhesh@Revision-PC:~/text-generation-webui$ deepspeed --num_gpus=1 server.py --deepspeed --cai-chat --no-stream
[2023-02-03 15:20:47,041] [WARNING] [runner.py:186:fetch_hostfile] Unable to find hostfile, will proceed with training with local resources only.
[2023-02-03 15:20:47,070] [INFO] [runner.py:548:main] cmd = /home/siddhesh/anaconda3/envs/textgen/bin/python -u -m deepspeed.launcher.launch --world_info=eyJsb2NhbGhvc3QiOiBbMF19 --master_addr=127.0.0.1 --master_port=29500 --enable_each_rank_log=None server.py --deepspeed --cai-chat --no-stream
[2023-02-03 15:20:47,986] [INFO] [launch.py:142:main] WORLD INFO DICT: {'localhost': [0]}
[2023-02-03 15:20:47,986] [INFO] [launch.py:148:main] nnodes=1, num_local_procs=1, node_rank=0
[2023-02-03 15:20:47,986] [INFO] [launch.py:161:main] global_rank_mapping=defaultdict(<class 'list'>, {'localhost': [0]})
[2023-02-03 15:20:47,986] [INFO] [launch.py:162:main] dist_world_size=1
[2023-02-03 15:20:47,986] [INFO] [launch.py:164:main] Setting CUDA_VISIBLE_DEVICES=0
[2023-02-03 15:20:51,399] [INFO] [comm.py:657:init_distributed] Initializing TorchBackend in DeepSpeed with backend nccl
Loading pygmalion-2.7b...
[2023-02-03 15:20:57,020] [INFO] [launch.py:318:sigkill_handler] Killing subprocess 4459
[2023-02-03 15:20:57,056] [ERROR] [launch.py:324:sigkill_handler] ['/home/siddhesh/anaconda3/envs/textgen/bin/python', '-u', 'server.py', '--local_rank=0', '--deepspeed', '--cai-chat', '--no-stream'] exits with return code = -9

Unable to download models or convert them

Hello,

I have a weird issue when trying to download models, it tells me that :
File "D:\text-generation-webui\download-model.py", line 10, in
from bs4 import BeautifulSoup
ModuleNotFoundError: No module named 'bs4'

Except if I look at installs from requirements, I see that :
Collecting bs4==0.0.1
Using cached bs4-0.0.1-py3-none-any.whl

When trying to convert models, I get that :
File "D:\text-generation-webui\convert-to-torch.py", line 10, in
from transformers import AutoModelForCausalLM
ModuleNotFoundError: No module named 'transformers'

The only thing missing from the requirements is :
ERROR: Could not find a version that satisfies the requirement mkl-fft==1.3.1 (from versions: none)
ERROR: No matching distribution found for mkl-fft==1.3.1

Can someone help me? It was working find 2 days ago.

Add a flag for using all CPU threads in CPU mode

Depending on CPU architecture, memory bandwidth and workload, it might sometimes be beneficial to use all CPU threads in CPU mode instead of just physical threads. This can be accomplished by adding torch.set_num_threads(t) somewhere appropriate in server.py, with t being the number of desired threads. The image below shows what I did on my local installation to take advantage of all CPU threads with my i7-12700K.

Ideally this could be automatically set as the reported total CPU thread count, perhaps with a command line enabling flag so that the current default behavior remains for those cases where using all CPU threads is not helpful.

https://pytorch.org/docs/stable/generated/torch.set_num_threads.html

image

BeautifulSoup soup is not installed when going through the install instructions

BeautifulSoup soup isn't installed so you can't download a model

(textgen)
text-generation-webui on ๎‚  main [?] via ๐Ÿ v3.10.9 via ๐Ÿ…’ textgen
โฏ python download-model.py EleutherAI/gpt-j-6B
Traceback (most recent call last):
  File "/home/noah/Documents/textgen/text-generation-webui/download-model.py", line 10, in <module>
    from bs4 import BeautifulSoup
ModuleNotFoundError: No module named 'bs4'
(textgen)
text-generation-webui on ๎‚  main [?] via ๐Ÿ v3.10.9 via ๐Ÿ…’ textgen

This is as easy to fix as running

(textgen)
text-generation-webui on ๎‚  main [?] via ๐Ÿ v3.10.9 via ๐Ÿ…’ textgen
โฏ pip install BeautifulSoup4

I imagine this is as simple to fix as adding it to requirements .txt but it isn't too much of a hassle to fix manually

Unable to install deepspeed

Hi, i don't think this is repo specific issue, but i am unable to install on windows 11 RTX 20s AMD Ryzen due to this error:

Collecting deepspeed==0.8.0
Using cached deepspeed-0.8.0.tar.gz (749 kB)
Preparing metadata (setup.py) ... error
error: subprocess-exited-with-error
ร— python setup.py egg_info did not run successfully.
โ”‚ exit code: 1
โ•ฐโ”€> [13 lines of output]
Traceback (most recent call last):
File "", line 2, in
File "", line 34, in
File "C:\Temp\pip-install-vr9o447d\deepspeed_d266f5d51e7e4709841a20afde65dd1e\setup.py", line 156, in
abort(f"Unable to pre-compile {op_name}")
File "C:\Temp\pip-install-vr9o447d\deepspeed_d266f5d51e7e4709841a20afde65dd1e\setup.py", line 48, in abort
assert False, msg
AssertionError: Unable to pre-compile async_io
DS_BUILD_OPS=1
๏ฟฝ[93m [WARNING] ๏ฟฝ[0m async_io requires the dev libaio .so object and headers but these were not found.
๏ฟฝ[93m [WARNING] ๏ฟฝ[0m If libaio is already installed (perhaps from source), try setting the CFLAGS and LDFLAGS environment variables to where it can be found.
๏ฟฝ[93m [WARNING] ๏ฟฝ[0m One can disable async_io with DS_BUILD_AIO=0
๏ฟฝ[31m [ERROR] ๏ฟฝ[0m Unable to pre-compile async_io
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
error: metadata-generation-failed
ร— Encountered error while generating package metadata.
โ•ฐโ”€> See above for output.
note: This is an issue with the package mentioned above, not pip.
hint: See above for details.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.