Python bindings for the Orion FHE evaluator
Project description
orion-evaluator
Python bindings to the Orion Go evaluator. Runs FHE inference on compiled models.
Why keys are passed as bytes
The Evaluator constructor accepts serialized MemEvaluationKeySet bytes, not Go object handles:
evaluator = Evaluator(params_dict, keys_bytes) # bytes, not handles
This looks weird if you're generating keys and running inference in the same Python process — you serialize a Go object to bytes just to deserialize it back into a Go object on the other side. The reason: Go has shitty FFI.
Each CGO shared library (.so) embeds its own Go runtime with its own GC, goroutine scheduler, and cgo.Handle table. The lattigo package (keygen, encrypt, decrypt) and orion-evaluator (inference) are separate .so files, so a cgo.Handle from one means nothing to the other. They are two isolated Go worlds in the same process. There is no way to share Go pointers across them.
So we serialize to bytes as the common language between the two runtimes. This is also the right interface for real deployments where keys come over the network from a remote client.
Usage
from orion_evaluator import Model, Evaluator
# Context manager support (recommended — auto-cleanup on block exit)
with Model.load(model_bytes) as model:
params_dict, manifest, input_level = model.client_params()
with Evaluator(params_dict, keys_bytes) as evaluator:
result_ct_bytes = evaluator.forward(model, input_ct_bytes)
# Or explicit close()
model = Model.load(model_bytes)
evaluator = Evaluator(params_dict, keys_bytes)
result_ct_bytes = evaluator.forward(model, input_ct_bytes)
evaluator.close()
model.close()
Errors
All errors raise from orion_evaluator.errors:
EvaluatorError— base class for all evaluator errorsModelLoadError(EvaluatorError)— raised byModel.load()on invalid 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
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 orion_v2_evaluator-2.0.1.tar.gz.
File metadata
- Download URL: orion_v2_evaluator-2.0.1.tar.gz
- Upload date:
- Size: 9.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
cd814cd3ea5e7a35de2ef18f0a737796316d4ce47052eb5d8937828a9c4263b7
|
|
| MD5 |
2dbc1ed8f70ba512ce807552b8f9ea55
|
|
| BLAKE2b-256 |
2125f5a2039d14fdf41c7b157c602a9201091de38b203ff8ec4eded260201931
|
File details
Details for the file orion_v2_evaluator-2.0.1-py3-none-any.whl.
File metadata
- Download URL: orion_v2_evaluator-2.0.1-py3-none-any.whl
- Upload date:
- Size: 6.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3d2f6fbbac94272993fccc3a83f46eb4c46bffecdead84b063d9c0c2ea6d4f06
|
|
| MD5 |
dbdc59ce7632b4dbcd04ed279d2ce432
|
|
| BLAKE2b-256 |
b999bbaf263cf709152ae3c9349db4770401e02d1edaa6c1904ca793fde5b18b
|