Skip to main content

Orion FHE compiler — traces, fits, and compiles PyTorch neural networks for encrypted inference

Project description

orion-v2-compiler

Orion FHE compiler — traces, fits, and compiles PyTorch neural networks for encrypted inference using the CKKS scheme.

Part of the Orion FHE framework.

Usage

import orion_compiler.nn as on
from orion_compiler import Compiler, CKKSParams

class MLP(on.Module):
    def __init__(self):
        super().__init__()
        self.flatten = on.Flatten()
        self.fc1 = on.Linear(784, 128)
        self.act1 = on.Quad()
        self.fc2 = on.Linear(128, 10)

    def forward(self, x):
        x = self.flatten(x)
        x = self.act1(self.fc1(x))
        return self.fc2(x)

net = MLP()
compiler = Compiler(net, CKKSParams(logn=14, logq=[55, 40, 40, 40], logp=[61, 61], logscale=40))
compiler.fit(dataloader)
compiled = compiler.compile()
model_bytes = compiled.to_bytes()

Modules

  • orion_compilerCompiler, CKKSParams, CompiledModel, Graph, GraphNode, GraphEdge, KeyManifest, CompilerConfig, CostProfile
  • orion_compiler.nn — FHE-compatible layers (cleartext-only forward)
  • orion_compiler.core — Compilation algorithms (tracer, packing, level assignment, auto-bootstrap, galois)

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_compiler-2.0.1.tar.gz (42.2 kB view details)

Uploaded Source

Built Distribution

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

orion_v2_compiler-2.0.1-py3-none-any.whl (51.9 kB view details)

Uploaded Python 3

File details

Details for the file orion_v2_compiler-2.0.1.tar.gz.

File metadata

  • Download URL: orion_v2_compiler-2.0.1.tar.gz
  • Upload date:
  • Size: 42.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.9

File hashes

Hashes for orion_v2_compiler-2.0.1.tar.gz
Algorithm Hash digest
SHA256 a72289abd6fd4a2318da2c1475d9d8b17992f52807255b00938c5789200b50d1
MD5 e2ca1ae273b28d8967039f7841e63016
BLAKE2b-256 7d5df7ca3ed9b7ad929a4daf4bde19851a6c66589464f9b07d4e530e0387c949

See more details on using hashes here.

File details

Details for the file orion_v2_compiler-2.0.1-py3-none-any.whl.

File metadata

File hashes

Hashes for orion_v2_compiler-2.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 0ae06239c7c124d4755ea63c08515f26a3f0de9ec7482032fec491437375fd19
MD5 2595f392fa435e0551a1704be7f813db
BLAKE2b-256 0c096fab8c1c2c42b0dceac8da386db212e6da1845b89fdb6f82fae8b0a9ddc1

See more details on using hashes here.

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