Skip to main content

Serve llama models locally

Project description

Llama serve

Serve llama models locally.

  • ⬇️ Downloads weights from S3

  • 📦 Unpacks

  • 🚀 Serves via a local OpenAI-compatible server

Prerequisites

Software

  • Python 3.12

Hardware

  • A GPU with >=24GB VRAM (tested on NVIDIA A30)

Configuration

  • Create a file called .env in the directory where you intend to run this package. Populate it with the details you have been provided with in the following format:
MODEL_NAME=
WEIGHTS_ID=
WEIGHTS_KEY=

Installation

  1. (Recommended) Create a virtual environment and activate it:
python -m venv .venv
source .venv/bin/activate
  1. Install this package: pip install londonaicentre-llama-serve.

Usage

CLI

  1. Note command line arguments:

    Argument Description
    -v, --verbose Enable debug output (optional)
  2. Start the server as follows: llamaserve [args].

Clients

OpenAI (example)

  1. Interact with the server using the OpenAI client in python:

    from openai import OpenAI
    
    client = OpenAI(
        base_url="http://localhost:5000/v1",
        api_key="blank" 
    )
    
    response = client.chat.completions.create(
        model="<MODEL_NAME>",
        messages=[
            {"role": "system", "content": "You are an LLM named gpt-4o"},
            {"role": "user", "content": "Hello"}
        ]
    )
    
    print(response.choices[0].message.content)
    

License

This project uses the CC BY-NC-ND 4.0 license (see LICENSE).

The contents of this repository are designed for NHS organisations to use on private data.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

londonaicentre_llama_serve-1.1.1.tar.gz (19.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

londonaicentre_llama_serve-1.1.1-py3-none-any.whl (19.0 kB view details)

Uploaded Python 3

File details

Details for the file londonaicentre_llama_serve-1.1.1.tar.gz.

File metadata

File hashes

Hashes for londonaicentre_llama_serve-1.1.1.tar.gz
Algorithm Hash digest
SHA256 673b82fa315a90f5151f105133a1fb9154a42456d8f7c44d703e7e45781de791
MD5 15aa0ba539f580cdf9cfaffe718b4957
BLAKE2b-256 0640d260d33d6936d54664a4e5dfd73fc44c6266bfdb44d0bbdb54a81f2a37e6

See more details on using hashes here.

Provenance

The following attestation bundles were made for londonaicentre_llama_serve-1.1.1.tar.gz:

Publisher: llamaserve-build-and-publish.yml on londonaicentre/schema-llama

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file londonaicentre_llama_serve-1.1.1-py3-none-any.whl.

File metadata

File hashes

Hashes for londonaicentre_llama_serve-1.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 753388b6f89846d2e4254a3d23832f1f90e1cbc9954af682fadc77f7cbb3360b
MD5 dc58916d0be58d3520f1405725f0bda8
BLAKE2b-256 8904d8c6ee8732ac269fa64e3b092bae2bcf494117dadc8bdb7c78239b2cbe0a

See more details on using hashes here.

Provenance

The following attestation bundles were made for londonaicentre_llama_serve-1.1.1-py3-none-any.whl:

Publisher: llamaserve-build-and-publish.yml on londonaicentre/schema-llama

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page