Skip to main content

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 errors
  • ModelLoadError(EvaluatorError) — raised by Model.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

orion_v2_evaluator-2.1.1.tar.gz (6.2 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

orion_v2_evaluator-2.1.1-py3-none-any.whl (6.3 MB view details)

Uploaded Python 3

File details

Details for the file orion_v2_evaluator-2.1.1.tar.gz.

File metadata

  • Download URL: orion_v2_evaluator-2.1.1.tar.gz
  • Upload date:
  • Size: 6.2 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for orion_v2_evaluator-2.1.1.tar.gz
Algorithm Hash digest
SHA256 dd1bb3586bba7fc5f01917a0329ccfdb5ea35fe7688e452fa6acfaca58d606b0
MD5 268df9768fcc7bc7849fb218f1d70d4b
BLAKE2b-256 bd325230f7b82fd0337726b137a226dcb8351bc788c7ae281f2d9848cc5b2b47

See more details on using hashes here.

Provenance

The following attestation bundles were made for orion_v2_evaluator-2.1.1.tar.gz:

Publisher: release.yml on butvinm/orion

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file orion_v2_evaluator-2.1.1-py3-none-any.whl.

File metadata

File hashes

Hashes for orion_v2_evaluator-2.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 1a4e9a1bfb67a723852a4e61d2d0d0359fe40ff29ebbd78f4b1f50d1c0a48869
MD5 1ddd6a9aa64829d5d2137b61d094c1e5
BLAKE2b-256 16395c54c058400e11968ca0ebc8fc40f75ac394ba9cdf92660360b67957fadf

See more details on using hashes here.

Provenance

The following attestation bundles were made for orion_v2_evaluator-2.1.1-py3-none-any.whl:

Publisher: release.yml on butvinm/orion

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