PygmalionAI's large-scale inference engine
pygmalion.chat

It is designed to serve as the inference endpoint for the PygmalionAI website, and to allow serving the Pygmalion models to a large number of users with blazing fast speeds (thanks to vLLM's Paged Attention).

AlpinDale c1c37c755d bump version to 0.6.0 il y a 4 mois
.github cc7a636ffd ci: add action for deploying docs il y a 4 mois
aphrodite c1c37c755d bump version to 0.6.0 il y a 4 mois
assets b3df2351c8 readme: update with bsz1 graph il y a 10 mois
cmake 141672a0d4 kernels: disambiguate quantized types via a new ScalarType il y a 4 mois
docker b15e6376f8 bump to torch 2.4.0, add aphrodite_flash_attn (#614) il y a 4 mois
docs 638784c3c9 docs: fix typos il y a 4 mois
examples 4d4e767838 ci: take one of fixing lint issues il y a 4 mois
kernels 0e6c400b13 feat: re-add GGUF (#600) il y a 4 mois
tests 4d4e767838 ci: take one of fixing lint issues il y a 4 mois
.clang-format 04d22bf1a9 add clang-format il y a 5 mois
.dockerignore 6a57861fca feat: initial XPU support via intel_extension_for_pytorch (#571) il y a 5 mois
.env f6250c5516 move dockerfiles to root; fix cpu build il y a 5 mois
.gitignore 0c17c2a8a7 chore: add commit hash, clean up engine logs il y a 4 mois
CMakeLists.txt 0e6c400b13 feat: re-add GGUF (#600) il y a 4 mois
CODE_OF_CONDUCT.md 9c45fe9a2a openai: fix metrics endpoint (#512) il y a 6 mois
CONTRIBUTING.md 9c45fe9a2a openai: fix metrics endpoint (#512) il y a 6 mois
Dockerfile 523ac99aca chore: pipeline parallel with Ray accelerated dag il y a 4 mois
Dockerfile.cpu 7844103e43 build: update torch to 2.4.0 for cpu il y a 4 mois
Dockerfile.neuron f6250c5516 move dockerfiles to root; fix cpu build il y a 5 mois
Dockerfile.openvino 141672a0d4 kernels: disambiguate quantized types via a new ScalarType il y a 4 mois
Dockerfile.ppc64le 271a680026 feat: inference support for PowerPC ISA il y a 5 mois
Dockerfile.rocm 98f9dbd734 feat: Triton Kernels for Punica (#613) il y a 4 mois
Dockerfile.tpu fbec255dc1 chore: enable tpu tensor parallel in async engine il y a 4 mois
Dockerfile.xpu 6a57861fca feat: initial XPU support via intel_extension_for_pytorch (#571) il y a 5 mois
LICENSE 5adcb33e14 Revert license back to AGPLv3 (#38) il y a 1 an
MANIFEST.in 523ac99aca chore: pipeline parallel with Ray accelerated dag il y a 4 mois
README.md 949f0445de readme: update installation command il y a 8 mois
build_wheel.sh 75122b20ef chore: refactor wheel build script il y a 4 mois
config.yaml f18eeaf59a ci: codespell fixes il y a 4 mois
docker-compose.yml f6250c5516 move dockerfiles to root; fix cpu build il y a 5 mois
entrypoint.sh f6250c5516 move dockerfiles to root; fix cpu build il y a 5 mois
env.py e42a78381a feat: switch from pylint to ruff (#322) il y a 9 mois
environment.yaml b15e6376f8 bump to torch 2.4.0, add aphrodite_flash_attn (#614) il y a 4 mois
formatting.sh c4933b1a6d ci: remove yapf from the formatting script il y a 4 mois
mypy.ini 9d81716bfd [v0.5.3] Release Candidate (#388) il y a 8 mois
patch_xformers.rocm.sh 13d850334e fix: navi support (#283) il y a 10 mois
pyproject.toml f18eeaf59a ci: codespell fixes il y a 4 mois
requirements-adag.txt 523ac99aca chore: pipeline parallel with Ray accelerated dag il y a 4 mois
requirements-build.txt 44d81c3a3e chore: bump torch to 2.4.0 il y a 4 mois
requirements-common.txt 0e6c400b13 feat: re-add GGUF (#600) il y a 4 mois
requirements-cpu.txt 7844103e43 build: update torch to 2.4.0 for cpu il y a 4 mois
requirements-cuda.txt b15e6376f8 bump to torch 2.4.0, add aphrodite_flash_attn (#614) il y a 4 mois
requirements-dev.txt 6b1fdd07bd chore: add isort and refactor formatting script and utils il y a 4 mois
requirements-lint.txt 6b1fdd07bd chore: add isort and refactor formatting script and utils il y a 4 mois
requirements-neuron.txt 9d81716bfd [v0.5.3] Release Candidate (#388) il y a 8 mois
requirements-openvino.txt 0e6c400b13 feat: re-add GGUF (#600) il y a 4 mois
requirements-rocm.txt fa15bad2ea chore: minor AMD fixes il y a 4 mois
requirements-test.txt 523ac99aca chore: pipeline parallel with Ray accelerated dag il y a 4 mois
requirements-tpu.txt 4abbbdad78 chore: make triton fully optional il y a 4 mois
requirements-xpu.txt 6a57861fca feat: initial XPU support via intel_extension_for_pytorch (#571) il y a 5 mois
runtime.sh cbe37e8b18 fix: speed up cuda home detection (#288) il y a 10 mois
setup.py 141672a0d4 kernels: disambiguate quantized types via a new ScalarType il y a 4 mois
update-runtime.sh b15e6376f8 bump to torch 2.4.0, add aphrodite_flash_attn (#614) il y a 4 mois

README.md

Breathing Life into Language

aphrodite

Aphrodite is the official backend engine for PygmalionAI. It is designed to serve as the inference endpoint for the PygmalionAI website, and to allow serving the Pygmalion models to a large number of users with blazing fast speeds (thanks to vLLM's Paged Attention).

Aphrodite builds upon and integrates the exceptional work from various projects.

The compute necessary for Aphrodite's development is provided by Arc Compute.

Features

  • Continuous Batching
  • Efficient K/V management with PagedAttention from vLLM
  • Optimized CUDA kernels for improved inference
  • Quantization support via AQLM, AWQ, Bitsandbytes, EXL2, GGUF, GPTQ, QuIP#, Smoothquant+, and SqueezeLLM
  • Distributed inference
  • Variety of sampling methods (Mirostat, Locally Typical Sampling, Tail-Free Sampling, etc)
  • 8-bit KV Cache for higher context lengths and throughput, at both FP8 and INT8 formats.

Quickstart

Install the engine:

$ pip install -U aphrodite-engine --extra-index-url https://downloads.pygmalion.chat/whl

Then launch a model:

$ aphrodite run meta-llama/Meta-Llama-3-8B-Instruct

This will create a OpenAI-compatible API server that can be accessed at port 2242 of the localhost. You can plug in the API into a UI that supports OpenAI, such as SillyTavern.

Please refer to the wiki for the full list of arguments and flags you can pass to the engine.

You can play around with the engine in the demo here:

Open In Colab

Docker

Additionally, we provide a Docker image for easy deployment. Here's a basic command to get you started:

sudo docker run -d -e MODEL_NAME="mistralai/Mistral-7B-Instruct-v0.2" -p 2242:2242 --gpus all --ipc host alpindale/aphrodite-engine

This will pull the Aphrodite Engine image (~9GiB download), and launch the engine with the Mistral-7B model at port 2242. Check here for the full list of env variables.

See here for the Compose file to use with Docker Compose.

Requirements

  • Operating System: Linux (or WSL for Windows)
  • Python: at least 3.8

For windows users, it's recommended to use tabbyAPI instead, if you do not need batching support.

Build Requirements:

  • CUDA >= 11

For supported GPUs, see here. Generally speaking, all semi-modern GPUs are supported - down to Pascal (GTX 10xx, P40, etc.)

Installation

Usage

For usage, please refer to the wiki page for detailed instructions. Aphrodite provides many different options for LLM inference, so please read through the list of options here.

Performance

Speeds vary with different GPUs, model sizes, quantization schemes, batch sizes, etc. Here are some baseline benchmarks conducted by requesting as many completions as possible from the API server.

Batch Size 1 Performance

These are the speeds a user would normally get if they request a single output with a sizable prompt and output length. Essentially, normal chatting experience.

The following results were gathered by sending a request with 8192 prompt tokens and requesting 1024 tokens with ignore_eos=True.

GPU: NVIDIA A40, Mistral 7B. Baseline is the same model loaded with text-generation-webui in FP16.

High Batch Size Performance

Work in Progress.

Notes

  1. By design, Aphrodite takes up 90% of your GPU's VRAM. If you're not serving an LLM at scale, you may want to limit the amount of memory it takes up. You can do this in the API example by launching the server with the --gpu-memory-utilization 0.6 (0.6 means 60%).

  2. You can view the full list of commands by running aphrodite run --help.

  3. Context Length extension via the RoPE method is supported for most models. Use the command-line flag --max-model-len to specify a desired context length and the engine will adjust the RoPE scaling accordingly.

  4. Please refer to the FAQ & Issues if you run into problems. If you don't find an answer there, please make an issue.

Acknowledgements

Aphrodite Engine would have not been possible without the phenomenal work of other open-source projects. Credits go to:

Contributing

Everyone is welcome to contribute. You can support the project by opening Pull Requests for new features, fixes, or general UX improvements.