An HTTP API to serve local LLM Models.
Go to file
Cyberes 747d838138 move where the vllm model is set 2023-09-11 21:05:22 -06:00
config implement vllm backend 2023-09-11 20:47:19 -06:00
llm_server move where the vllm model is set 2023-09-11 21:05:22 -06:00
other get working with ooba again, give up on dockerfile 2023-09-11 09:51:01 -06:00
templates implement vllm backend 2023-09-11 20:47:19 -06:00
.gitignore update gitignore 2023-08-24 00:10:22 -06:00
LICENSE Initial commit 2023-08-21 14:40:46 -06:00
README.md implement streaming for hf-textgen 2023-08-29 17:56:12 -06:00
requirements.txt implement vllm backend 2023-09-11 20:47:19 -06:00
server.py implement vllm backend 2023-09-11 20:47:19 -06:00

README.md

local-llm-server

An HTTP API to serve local LLM Models.

The purpose of this server is to abstract your LLM backend from your frontend API. This enables you to make changes to (or even switch) your backend without affecting your clients.

Install

  1. sudo apt install redis
  2. python3 -m venv venv
  3. source venv/bin/activate
  4. pip install -r requirements.txt
  5. python3 server.py

An example systemctl service file is provided in other/local-llm.service.

Configure

First, set up your LLM backend. Currently, only oobabooga/text-generation-webui is supported, but eventually huggingface/text-generation-inference will be the default.

Then, configure this server. The config file is located at config/config.yml.sample so copy it to config/config.yml.

  1. Set backend_url to the base API URL of your backend.
  2. Set token_limit to the configured token limit of the backend. This number is shown to clients and on the home page.

To set up token auth, add rows to the token_auth table in the SQLite database.

token: the token/password.

type: the type of token. Currently unused (maybe for a future web interface?) but required.

priority: the lower this value, the higher the priority. Higher priority tokens are bumped up in the queue line.

uses: how many responses this token has generated. Leave empty.

max_uses: how many responses this token is allowed to generate. Leave empty to leave unrestricted.

expire: UNIX timestamp of when this token expires and is not longer valid.

disabled: mark the token as disabled.

Use

DO NOT lose your database. It's used for calculating the estimated wait time based on average TPS and response tokens and if you lose those stats your numbers will be inaccurate until the database fills back up again. If you change GPUs, you should probably clear the generation_time time column in the prompts table.

To Do

  • Implement streaming
  • Add huggingface/text-generation-inference
  • Convince Oobabooga to implement concurrent generation
  • Make sure stats work when starting from an empty database
  • Make sure we're correctly canceling requests when the client cancels
  • Implement auth and tokens on the websocket endpoint. Maybe add something to the instruct prompt and the remove it before proxying??