Supersayan
A high‑performance Python library that integrates Fully Homomorphic Encryption (FHE) into PyTorch workflows. Supersayan provides:
- A client/server path to offload selected layers to a remote FHE server (hybrid mode).
- Zero‑copy tensor bridges across PyTorch, NumPy, CuPy, and Julia.
The Julia backend is managed via juliacall and initialized automatically on first import, or explicitly with a helper CLI.
Installation
From PyPI:
pip install supersayan
# or with uv
uv add supersayan
Default behavior:
- After install, importing
supersayantriggers a one‑time Julia backend setup automatically. No extra step is needed for typical users.
Optional (CI/Docker or troubleshooting):
# Manually initialize the Julia backend if you want explicit control
supersayan-setup
Advanced control (not recommended for regular users):
- To prevent network access during import in CI images, set
SUPERSAYAN_SKIP_JULIA_SETUP=1and runsupersayan-setupin a controlled build step.
Notes:
- GPU support uses CuPy when available; code runs on CPU otherwise.
Hybrid Remote Inference
Run the TCP server:
python scripts/run_server.py --host 127.0.0.1 --port 8000 --models-dir /tmp/supersayan/models
Use the client to execute only selected layers remotely in FHE while keeping other ops local:
import torch
import torch.nn as nn
from supersayan.core.types import SupersayanTensor
from supersayan.remote import SupersayanClient
class SmallCNN(nn.Module):
def __init__(self):
super().__init__()
self.conv = nn.Conv2d(1, 4, 3, padding=1)
self.fc = nn.Linear(4*28*28, 10)
def forward(self, x):
x = torch.relu(self.conv(x))
return self.fc(x.view(x.size(0), -1))
cnn = SmallCNN().eval()
client = SupersayanClient(
server_url="127.0.0.1:8000",
torch_model=cnn,
fhe_modules=[nn.Conv2d, nn.Linear], # offload these layers
)
x = SupersayanTensor(torch.randn(1, 1, 28, 28))
y = client(x)
For a runnable example of the TCP server, see scripts/run_server.py.
Supported offloaded layers: nn.Linear, nn.Conv2d.
Tensors and Interop
SupersayanTensor(data, device=...)acceptstorch.Tensor,numpy.ndarray, orcupy.ndarrayand preserves dtype float32.- Helpers:
SupersayanTensor.zeros(...),ones(...),randn(...). - Interop:
.to_numpy(),.to_dlpack(), and zero‑copy conversion to Julia via.to_julia().
Project Layout
src/supersayan/core, layers, remote client/server, Julia backendscripts/runnable examples (run_server.py)
Troubleshooting
- If Julia setup fails on first import, run
supersayan-setupmanually. - In CI or headless environments, set
SUPERSAYAN_SKIP_JULIA_SETUP=1during import and runsupersayan-setupexplicitly in a build step.
Metadata
Release files for supersayan 0.1.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| supersayan-0.1.3.tar.gz | 22.9 kB | Without provenance | Details for supersayan-0.1.3.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| supersayan-0.1.3-py3-none-any.whl | Python 3 | none | any | Details for supersayan-0.1.3-py3-none-any.whl |
Total release size: 49.3 kB
Release files / supersayan-0.1.3.tar.gz
| Download URL | supersayan-0.1.3.tar.gz |
|---|---|
| Size | 22.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
03dd80e34963906b7a66af6b8edbcb115ebfdd6d1e086fad77e5a58bdf1882cb
|
|
BLAKE2b-256 checksum How to use checksums |
d0dcb9e649cfc0406319b311485ac48ea5abf72bd8eaedb8bd3805abc5af7281
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.6.5
|
Release files / supersayan-0.1.3-py3-none-any.whl
| Download URL | supersayan-0.1.3-py3-none-any.whl |
|---|---|
| Size | 26.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
e803cb8cfe8ceb99d931e64490eeafcc1c054d34e49a85771d814ce94b48f7bc
|
|
BLAKE2b-256 checksum How to use checksums |
07ab5f2b8bdc9969ad894fc3c8e9dde60b224d311ceeab6b3d05773ac7db23d4
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.6.5
|
Security for supersayan 0.1.3
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.