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.0.tar.gz (12.5 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.0-py3-none-any.whl (12.5 kB view details)

Uploaded Python 3

File details

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

File metadata

File hashes

Hashes for londonaicentre_llama_serve-1.1.0.tar.gz
Algorithm Hash digest
SHA256 041b44bbc37b87188265c179c44b6653bb6ca8762377c553598580a4c65de76e
MD5 b42edc4dbb25fe2bf37b36213d6b288f
BLAKE2b-256 277c88690ab0d46ded774b7bbaa28c1c14359b3f687f322b568e235d8078901d

See more details on using hashes here.

Provenance

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

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

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.0-py3-none-any.whl.

File metadata

File hashes

Hashes for londonaicentre_llama_serve-1.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 cc3e7dbacc0df3e4a511ec96adabd05b0d2f3f64fe73c9d6dd484ae00fe354f0
MD5 1411fc61b027c903a4a0660cb998ddbf
BLAKE2b-256 0f7209126b21afd83b0013c489c9e34fe6cb2c1f8f6dd1bba1c24d3724ad1692

See more details on using hashes here.

Provenance

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

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

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