nillion aivm
1.0.0
AIVMは、高度な暗号化プロトコルを使用したプライバシーを提供する推論のために設計された最先端のフレームワークです。 AIVMを使用すると、ローカル開発ネットワーク(DEVNET)を展開して、提供された例またはカスタムモデルを使用してプライベート推論を探索できます。
仮想環境を作成します:
python3 -m venv .venv仮想環境を有効にします:
Linux/macosについて:
source .venv/bin/activateWindows:
. v env S cripts a ctivateパッケージをインストールします:
例を実行する場合は、実行します。
pip install " nillion-aivm[examples] "それ以外の場合は、独自のコードを作成する場合は、次のことができます。
pip install nillion-aivmAIVM devnetを開始します:
aivm-devnet提供されたjupyterノートブックの例/getStarted.ipynbを開き、AIVMでプライベート推論の例を実行します。
タスクを完了したら、 CTRL+Cを押してDevNetプロセスを終了します。
追加の使用については、AIVMを使用してプライベート推論ワークフローをセットアップする方法を示すExamplesフォルダーを参照してください。
import aivm_client as aic
# List all supported models
available_models = aic . get_supported_models ()
print ( available_models ) import torch
# Create a sample input (e.g., for LeNet5 MNIST)
random_input = torch . randn (( 1 , 1 , 28 , 28 )) # Batch size 1, 1 channel, 28x28 pixels # Encrypt the input
encrypted_input = aic . LeNet5Cryptensor ( random_input ) # Get prediction while maintaining privacy
result = aic . get_prediction ( encrypted_input , "LeNet5MNIST" ) get_prediction関数は、 aivm-devnetノードを使用して安全な計算プロトコルを自動的に処理し、推論プロセス全体で入力データがプライベートのままであることを保証します。
サポートされているアーキテクチャ(BerttinyまたはLENET5)に従うと、独自のトレーニングモデルをAIVMに展開できます。
import aivm_client as aic # For BertTiny models
aic . upload_bert_tiny_model ( model_path , "MyCustomBertTiny" )
# For LeNet5 models
aic . upload_lenet5_model ( model_path , "MyCustomLeNet5" ) # For BertTiny models
result = aic . get_prediction ( private_berttiny_input , "MyCustomBertTiny" )
# For LeNet5 models
result = aic . get_prediction ( private_lenet5_input , "MyCustomLeNet5" )このプロジェクトは、MITライセンスの下でライセンスされています。