text-generation-webui/docs/llama.cpp-models.md

54 lines
1.5 KiB
Markdown
Raw Normal View History

# Using llama.cpp in the web UI
2023-04-22 01:34:13 -04:00
## Setting up the models
#### Pre-converted
2023-04-22 01:34:13 -04:00
2023-05-11 08:47:36 -04:00
Place the model in the `models` folder, making sure that its name contains `ggml` somewhere and ends in `.bin`.
2023-04-22 01:34:13 -04:00
#### Convert LLaMA yourself
2023-04-22 01:34:13 -04:00
Follow the instructions in the llama.cpp README to generate the `ggml-model.bin` file: https://github.com/ggerganov/llama.cpp#usage
2023-06-01 11:04:31 -04:00
## GPU acceleration
2023-06-01 10:58:33 -04:00
Enabled with the `--n-gpu-layers` parameter.
* If you have enough VRAM, use a high number like `--n-gpu-layers 200000` to offload all layers to the GPU.
* Otherwise, start with a low number like `--n-gpu-layers 10` and then gradually increase it until you run out of memory.
2023-06-01 10:57:57 -04:00
To use this feature, you need to manually compile and install `llama-cpp-python` with GPU support.
2023-05-15 23:49:32 -04:00
#### Linux
```
pip uninstall -y llama-cpp-python
CMAKE_ARGS="-DLLAMA_CUBLAS=on" FORCE_CMAKE=1 pip install llama-cpp-python --no-cache-dir
```
2023-05-15 23:49:32 -04:00
#### Windows
```
pip uninstall -y llama-cpp-python
set CMAKE_ARGS="-DLLAMA_CUBLAS=on"
set FORCE_CMAKE=1
pip install llama-cpp-python --no-cache-dir
```
#### macOS
```
pip uninstall -y llama-cpp-python
CMAKE_ARGS="-DLLAMA_METAL=on" FORCE_CMAKE=1 pip install llama-cpp-python --no-cache-dir
```
Here you can find the different compilation options for OpenBLAS / cuBLAS / CLBlast: https://pypi.org/project/llama-cpp-python/
2023-04-22 01:34:13 -04:00
## Performance
This was the performance of llama-7b int4 on my i5-12400F (cpu only):
2023-04-22 01:34:13 -04:00
> Output generated in 33.07 seconds (6.05 tokens/s, 200 tokens, context 17)
You can change the number of threads with `--threads N`.