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.3.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.3.0.tar.gz | 15.8 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| verda_io-0.3.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 33.7 kB
Release files / verda_io-0.3.0.tar.gz
| Download URL | verda_io-0.3.0.tar.gz |
|---|---|
| Size | 15.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
cc9749b7adc52c7d4fad4fadf0e29037781373620434356e4bec02469689db40
|
|
BLAKE2b-256 checksum How to use checksums |
789715afe78eef6398ca6912144e1bc73fafdeeb18805ab51d5e9984f1e3d9ce
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.13
|
Release files / verda_io-0.3.0-py3-none-any.whl
| Download URL | verda_io-0.3.0-py3-none-any.whl |
|---|---|
| Size | 17.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
0fd78a3cf0b8bada71ea5234bcf76650bf7ca8f4cc7ea04c55926c7266a09496
|
|
BLAKE2b-256 checksum How to use checksums |
e7717fb3a34e834b774cbba45cadf8998e8576b77fe296db2ee43fc9524526cb
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.13
|