The official SDK for Rapha Protocol: Compute-to-Data AI Training
Project description
Rapha AI SDK
The official Python SDK for the Rapha Protocol—a decentralized "Compute-to-Data" network for AI model training over sensitive health data.
Instead of bringing data to the model, Rapha brings your model to the data using TEEs (Trusted Execution Environments) and ZK-TLS cryptography.
Installation
Install the package directly from PyPI:
pip install rapha-ai
Quickstart
Initialize the RaphaClient, fund the escrow contract (for compute nodes), and execute remote training over HIPAA-compliant medical datasets securely.
import torch
import torch.nn as nn
from rapha import RaphaClient
# 1. Define your PyTorch Model Architecture
class MedicalNet(nn.Module):
def __init__(self):
super().__init__()
self.fc1 = nn.Linear(3, 10)
self.fc2 = nn.Linear(10, 1)
def forward(self, x):
x = torch.relu(self.fc1(x))
return self.fc2(x)
model = MedicalNet()
# 2. Initialize the Rapha Client
# node_url defaults to production: https://api.rapha.ltd
# For local testing, pass: node_url="http://127.0.0.1:8000"
client = RaphaClient(escrow_contract_address="0xYourContractAddress")
# 3. Fund your job with USDC
job_id = client.fund_job(amount=100.0)
print(f"Funded Job: {job_id}")
# 4. Trigger remote training
# The model weights are packaged, sent to the node, computed against the dataset,
# and returned with a valid Zero-Knowledge proof.
zk_proof = client.train(model, target_dataset_id="hospital_dataset_1")
# 5. Model state is updated in-place automatically
print("Training Complete. Model weights updated securely.")
# 6. Push proof to on-chain settlement
client.settle(zk_proof)
print("Node provider paid. Transaction complete.")
Learn More
Visit rapha.ltd for protocol documentation and enterprise features.
Project details
Release history Release notifications | RSS feed
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 rapha_ai-0.1.0.tar.gz.
File metadata
- Download URL: rapha_ai-0.1.0.tar.gz
- Upload date:
- Size: 3.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
54a7dfa86dffb08af249eb8d2a8b90bafd200318b3bcb295b4343725e716fc50
|
|
| MD5 |
156074d37c4a3deb9504a7f4ea0be126
|
|
| BLAKE2b-256 |
e65497ae9b7fef80c5ba550c012744437c6d2716c344a4f8cb2596508931a610
|
File details
Details for the file rapha_ai-0.1.0-py3-none-any.whl.
File metadata
- Download URL: rapha_ai-0.1.0-py3-none-any.whl
- Upload date:
- Size: 4.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6dc53dace9c797563a1e7225642a40f0c87346613f2f3a6af7e9773ee70ffc62
|
|
| MD5 |
4dc871bf8d593f6e1d233e1f264b21e8
|
|
| BLAKE2b-256 |
d1ff60a4f4a58588b847d3507b98b3b32f285d5161f095ec4ae4e7bf5b9a5c33
|