Verda IO
Python worker framework for the Verda Inference Orchestrator.
Installation
pip install verda-io
Or with uv:
uv add verda-io
Quick Start
Create a worker with initialization and prediction functions:
import verda_io
@verda_io.initialize
def setup():
"""Called once at startup. Load your model here."""
global model
model = load_my_model()
@verda_io.predict
def predict(payload: bytes) -> bytes:
"""Called for each inference request."""
result = model(payload)
return result
Run it with the Verda server:
verda-io run server -c config.yaml
Or run the worker directly:
python -m verda_io main.py --socket /tmp/verda-io.data.sock --id worker-1
Ordered Initialization
When your startup sequence requires specific ordering, use @verda_io.initialize with an order parameter. Functions run in ascending order:
import verda_io
@verda_io.initialize(0)
def load_tokenizer():
global tokenizer
tokenizer = AutoTokenizer.from_pretrained("model-name")
@verda_io.initialize(1)
def load_model():
global model
model = AutoModelForCausalLM.from_pretrained("model-name")
@verda_io.initialize(2)
def warm_up():
model.generate(tokenizer("warm up", return_tensors="pt").input_ids)
Using @verda_io.initialize without an argument defaults to order 0. Multiple functions with the same order run in registration order.
Streaming Responses
Return a generator from your predict function to stream results:
@verda_io.predict
def predict(payload: bytes) -> bytes:
for token in model.generate_stream(payload):
yield token.encode()
API
@verda_io.initialize- Register a startup function (called once, supports ordering)@verda_io.predict- Register the prediction function (called per request, exactly one required)verda_io.run()- Start the worker loop programmatically
How It Works
The verda_io package connects to the Verda server via Unix domain sockets using a binary protocol (MessagePack + 12-byte headers). Initialization functions run once at startup in order, and @verda_io.predict is called for each inference request routed by the server.
Requirements
- Python 3.10+
- Linux or macOS (Unix domain sockets required)
License
Apache License 2.0
Metadata
Release files for verda-io 0.2.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| verda_io-0.2.0.tar.gz | 14.7 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| verda_io-0.2.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 31.1 kB
Release files / verda_io-0.2.0.tar.gz
| Download URL | verda_io-0.2.0.tar.gz |
|---|---|
| Size | 14.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
948500568f9dd5a2dd6963a90c0820b85b484b796a1a7eb9434c65472c2ecc7f
|
|
BLAKE2b-256 checksum How to use checksums |
d3814b43c03c5dfec8c4a06816563927d9902e61393b2d4552e022b8675704d4
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.11.6 {"installer":{"name":"uv","version":"0.11.6","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|
Release files / verda_io-0.2.0-py3-none-any.whl
| Download URL | verda_io-0.2.0-py3-none-any.whl |
|---|---|
| Size | 16.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
092f161976f0fcc936335bbd803be837927498dc1a160598f1b3b13e1aaee9f3
|
|
BLAKE2b-256 checksum How to use checksums |
12b06fa79895e2d5bf8b759d201e74d8b46b9e389e89d9fc9aa42162247641ee
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.11.6 {"installer":{"name":"uv","version":"0.11.6","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|