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.4.tar.gz (6.3 MB view details)

Uploaded Source

Built Distributions

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

orion_v2_evaluator-2.1.4-py3-none-manylinux_2_17_x86_64.whl (6.3 MB view details)

Uploaded Python 3manylinux: glibc 2.17+ x86-64

orion_v2_evaluator-2.1.4-py3-none-macosx_11_0_x86_64.whl (3.4 MB view details)

Uploaded Python 3macOS 11.0+ x86-64

orion_v2_evaluator-2.1.4-py3-none-macosx_11_0_arm64.whl (3.2 MB view details)

Uploaded Python 3macOS 11.0+ ARM64

File details

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

File metadata

  • Download URL: orion_v2_evaluator-2.1.4.tar.gz
  • Upload date:
  • Size: 6.3 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.4.tar.gz
Algorithm Hash digest
SHA256 8f11f00d36cd90aed447251dfe7b6e61aff396ce5d74677ae8e62846af4796c7
MD5 c7abe6f8cf9d5b86343cbe538a245826
BLAKE2b-256 c22442ee94b1596dbbfc5abd4926d63bb27cc1b7e97c18fce0f89e7207af6b41

See more details on using hashes here.

Provenance

The following attestation bundles were made for orion_v2_evaluator-2.1.4.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.4-py3-none-manylinux_2_17_x86_64.whl.

File metadata

File hashes

Hashes for orion_v2_evaluator-2.1.4-py3-none-manylinux_2_17_x86_64.whl
Algorithm Hash digest
SHA256 0f088249a0c5d0a8d52998df94a61c4d08e9be6521a60ffd3ae396b701d2bc4c
MD5 c62584f389623adf1b1fa75b2916a90a
BLAKE2b-256 f36c042a7ea4123a633911cb23f017b530f888483615b96a967bb52d12fdc1d0

See more details on using hashes here.

Provenance

The following attestation bundles were made for orion_v2_evaluator-2.1.4-py3-none-manylinux_2_17_x86_64.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.

File details

Details for the file orion_v2_evaluator-2.1.4-py3-none-macosx_11_0_x86_64.whl.

File metadata

File hashes

Hashes for orion_v2_evaluator-2.1.4-py3-none-macosx_11_0_x86_64.whl
Algorithm Hash digest
SHA256 23bf58c37b3f13eabe8609539fc4e928670d31dd68d6fbe2e40acb5397f6f7c8
MD5 3d4acc44b562f5253badd7912ea8e267
BLAKE2b-256 df816b4c7b9491da19f8578d323ce0cea67786aa71e39e20740d2bd2a68f8f6c

See more details on using hashes here.

Provenance

The following attestation bundles were made for orion_v2_evaluator-2.1.4-py3-none-macosx_11_0_x86_64.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.

File details

Details for the file orion_v2_evaluator-2.1.4-py3-none-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for orion_v2_evaluator-2.1.4-py3-none-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 b4ee21d2380587a923425169d4f71bd30b87c3c172fa2187f89757bc8de65aae
MD5 b9c94795f7265540ba95e7f4df001e22
BLAKE2b-256 0445e391de9e7ce9c655ba0e59b6cc2d205ca1da29f8cbf04e1a8559c5d1dcf1

See more details on using hashes here.

Provenance

The following attestation bundles were made for orion_v2_evaluator-2.1.4-py3-none-macosx_11_0_arm64.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