Serve MESA models locally
Project description
MESA local
Serve MESA 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
.envin 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=
vLLM configuration
The package provides a set of vLLM configuration files for runnings a specific model on a specific GPU.
In addition to MODEL_NAME, this can be specified by adding GPU to the .env.
Installation
-
(Recommended) Create a virtual environment and activate it:
python -m venv .venv source .venv/bin/activate
-
Install this package:
pip install londonaicentre-mesa-local.
Usage
CLI (primary)
-
Note command line arguments:
Argument Description -v, --verbose Enable debug output (optional) -
Start the server as follows:
mesalocal [args].
Library (secondary)
- Import and use the logic of this package as a library:
import asyncio
from mesalocal.weights import Weights
from mesalocal.inferrer import VLLM
vllm_config: VLLMConfig = VLLMConfig() # VLLMConfig(model_name="foo", gpu="bar") to use a vLLM config without a .env file
weights: Weights = Weights(vllm_config.model)
if weights.unpack():
vllm: VLLM = VLLM(weights.get_model_folder(), vllm_config)
async def run():
async for output in vllm.generate(prompt):
print(output.outputs[0].text)
asyncio.run(run())
Clients
OpenAI (example with Oncollama)
-
Interact with the server using the OpenAI client in python:
from openai import OpenAI from oncoschema.prompt_builder import PromptBuilder # pip install londonaicentre-oncoschema client = OpenAI( base_url="http://localhost:5000/v1", api_key="blank" ) response = client.chat.completions.create( model="oncollama3betav01", messages=[ {"role": "system", "content": PromptBuilder().build_main_prompt()}, {"role": "user", "content": "Diagnosis 01/01/26..."} ] ) print(response.choices[0].message.content)
License
This project uses a proprietary license (see LICENSE).
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file londonaicentre_mesa_local-1.4.2.tar.gz.
File metadata
- Download URL: londonaicentre_mesa_local-1.4.2.tar.gz
- Upload date:
- Size: 23.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: uv/0.10.7 {"installer":{"name":"uv","version":"0.10.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Amazon Linux","version":"2023","id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c3ed1f6c5877b938fbb2da2295189fc07c17aafbfe5c75577b3058ba680a80ad
|
|
| MD5 |
219c88048ac531c2db0f182a3348c778
|
|
| BLAKE2b-256 |
0c36ca9caaf8bee7bcb06d0d149a7ba255054797a7049d831fe47f8823b6f67e
|
File details
Details for the file londonaicentre_mesa_local-1.4.2-py3-none-any.whl.
File metadata
- Download URL: londonaicentre_mesa_local-1.4.2-py3-none-any.whl
- Upload date:
- Size: 23.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: uv/0.10.7 {"installer":{"name":"uv","version":"0.10.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Amazon Linux","version":"2023","id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6659b68255ab1ab489fb621f3cb522e256f0817bf9812c1d72f1c3529802597a
|
|
| MD5 |
41f921c21d899c6c43d6b8a5cd4b5f53
|
|
| BLAKE2b-256 |
d4c6f9aeb365cbfc644c596043213aa1d59775482b88065265483aa16125b60e
|