Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Orca sytorch #205

Draft
wants to merge 154 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
154 commits
Select commit Hold shift + click to select a range
9ae2194
init: torch like interface
kanav99 Oct 3, 2022
2d826fe
feat: add forward pass for many layers
kanav99 Oct 4, 2022
8ee28db
forward works, backward buggy
kanav99 Oct 4, 2022
6b2b9ec
fixed matmul bug
kanav99 Oct 4, 2022
bcbd291
fix backprop double free and start mnist training
kanav99 Oct 4, 2022
2885cea
training works somehow
kanav99 Oct 5, 2022
58eb082
fix memory leak in tensor.h
kanav99 Oct 5, 2022
8ef6947
fuck
kanav99 Oct 6, 2022
5803dc5
no clue what's happening
kanav99 Oct 6, 2022
0e864e7
save progress
kanav99 Oct 8, 2022
ee23a2b
fixed point trains now but initial accuracy is bad
kanav99 Oct 8, 2022
e4e262b
too much accuracy
kanav99 Oct 8, 2022
901e580
conv2d forward pass
kanav99 Oct 10, 2022
869e6c9
partial conv backward implementation
kanav99 Oct 11, 2022
adf2012
buggy but mine
kanav99 Oct 13, 2022
812c6c2
lenet training works
kanav99 Oct 13, 2022
b654638
fixed point lenet training works
kanav99 Oct 14, 2022
5952191
modularity but new sus behaviour discovered
kanav99 Oct 14, 2022
aecd1bf
linked minillama
kanav99 Oct 15, 2022
6921865
more cleanup
kanav99 Oct 15, 2022
309e832
removed GroupElement, untested
kanav99 Oct 15, 2022
9d296c7
some changes and keysize backend
kanav99 Oct 16, 2022
74e2381
add clear maxpool
kanav99 Oct 16, 2022
ded3617
forgot to add same code to cleartext.h
kanav99 Oct 16, 2022
737a635
relu maxpool optimization
kanav99 Oct 16, 2022
ec03673
llama integration
kanav99 Oct 17, 2022
c393b3c
key calculation
kanav99 Oct 17, 2022
473b6a4
added cifar10 dataset
kanav99 Oct 17, 2022
b331130
some cleanup
kanav99 Oct 17, 2022
5719385
progress
kanav99 Oct 18, 2022
049855c
progress bar and parallel loops
kanav99 Oct 18, 2022
57b3705
fix initialization but scale 16 still doesnt work in lenet
kanav99 Oct 18, 2022
c496ea5
memory access fix in reshape
kanav99 Oct 18, 2022
252fcb5
why are there nans?
kanav99 Oct 19, 2022
c28b480
fix nasty bias bug
kanav99 Oct 19, 2022
a968137
fixed point training is working
kanav99 Oct 20, 2022
2d515d8
read cifar10 in correct way
kanav99 Oct 20, 2022
21a05ef
fairly stable code
kanav99 Oct 27, 2022
91c508c
secure fwd pass of p-vgg16 complete
kanav99 Oct 28, 2022
3cae24f
RT backpass complete, maybe
kanav99 Oct 31, 2022
6bda11c
FC and RT works, maybe
kanav99 Oct 31, 2022
52fc6ca
small example looks bitwise equivalent
kanav99 Nov 1, 2022
4aa3580
piranha vgg bitwise equivalence in pt and ct
kanav99 Nov 2, 2022
1285474
added 2 round relu api
kanav99 Nov 2, 2022
63687a5
wild west now
kanav99 Nov 3, 2022
94aff00
llamaextended
kanav99 Nov 4, 2022
1def44d
stochastic relutruncate
kanav99 Nov 5, 2022
8ddfe77
add sci backend
kanav99 Nov 5, 2022
d46e612
double round maxpool
kanav99 Nov 6, 2022
365c0c5
maxpool backpass works yay
kanav99 Nov 8, 2022
ffa4f23
things look stable
kanav99 Nov 9, 2022
1dbb1fa
stochastic ars in llama
kanav99 Nov 9, 2022
667c9ee
bring back vgg code
kanav99 Nov 9, 2022
99165be
fixtofloat done untested
kanav99 Dec 5, 2022
5f6f5c8
successful link with secfloat
kanav99 Dec 5, 2022
7ddcbec
hard memory bug..
kanav99 Dec 6, 2022
7155ede
forgot to close file....
kanav99 Dec 8, 2022
5144e8a
float2fix done, a bit bug
kanav99 Dec 13, 2022
f7ef5df
fixed float2fix
kanav99 Dec 16, 2022
ff658fc
timing float operations
kanav99 Dec 16, 2022
01bfa22
branch add
kanav99 Dec 17, 2022
320ae34
batchnorm.py and main.cpp outputs match
kanav99 Dec 18, 2022
f67931f
match again
kanav99 Dec 18, 2022
8e8c6d8
cifar10 float with batchnorm trains
kanav99 Dec 19, 2022
0f767cd
ramdisk/mmap support
kanav99 Dec 19, 2022
a726b1f
batchnorm cleartext progress save
kanav99 Dec 20, 2022
757ded4
ramdisk fix
kanav99 Dec 20, 2022
e3d7971
major refactor before GPU integration
kanav99 Dec 22, 2022
c68a656
Refactor (#1)
kanav99 Feb 15, 2023
1078f4c
remove gpu code
kanav99 Feb 17, 2023
62ee65c
sytorch refactor part 1
kanav99 Feb 17, 2023
ac4cb9b
part 2
kanav99 Feb 17, 2023
940a221
works on macOS
kanav99 Feb 19, 2023
de3f283
cleartext resnet9 inference works
kanav99 Feb 21, 2023
c5e9033
llama ext works with resnet9
kanav99 Feb 21, 2023
c2a16a7
graph generation from code
kanav99 Feb 22, 2023
38bc49c
llama ext truncation optimization
kanav99 Feb 22, 2023
7f22698
resnet 32,12 still incorrect in llamaext
kanav99 Feb 22, 2023
7c7cf59
when shall the sun rise? resnet 32,12 works
kanav99 Feb 22, 2023
2025102
llama improved almost fully optimized, add is pita
kanav99 Feb 23, 2023
75ec790
minor refactor
kanav99 Feb 23, 2023
be77ed8
minor refactor
kanav99 Feb 23, 2023
1ae575a
sytorch modules lets goooo
kanav99 Feb 23, 2023
9a93dea
minor refactor
kanav99 Feb 23, 2023
fc04b85
minor cosmetics
kanav99 Feb 24, 2023
3990dec
basic garbage cleaning
kanav99 Feb 24, 2023
c222b3b
sequential was fine but was nice to refactor
kanav99 Feb 24, 2023
f498b3b
variadic add
kanav99 Feb 24, 2023
c1b07fa
concat works
kanav99 Feb 24, 2023
347aa66
vgg16 and chexpert untested
kanav99 Feb 25, 2023
360e408
small changes
kanav99 Feb 26, 2023
c5509fc
div support
kanav99 Feb 26, 2023
24b5a31
fixed model loading for chexpert
kanav99 Feb 27, 2023
1c4ae86
Onnx sytorch (#4)
drunkenlegend Mar 19, 2023
ac568a2
avgpool changes
kanav99 Mar 20, 2023
221182b
fix llama improved
kanav99 Mar 20, 2023
d8724d4
remove SCIConfig.cmake
kanav99 Mar 20, 2023
c2838cf
add SCIConfig.cmake to gitignore
kanav99 Mar 20, 2023
7aeb352
Orca dumping (#5)
kanav99 Mar 29, 2023
fc67130
add additional scripts
kanav99 Mar 29, 2023
2a1e023
conv/fc optimizations (#7)
kanav99 Apr 9, 2023
6484937
sequential fixed
kanav99 Apr 9, 2023
25377e9
buggy dcf with et
kanav99 Jul 31, 2023
674fb10
fix one bug
kanav99 Aug 1, 2023
48a2bc1
fix bug in dcf et
kanav99 Aug 1, 2023
5aa9889
more test for dcfet
kanav99 Aug 2, 2023
4aff784
security tight in dcf et
kanav99 Aug 2, 2023
7a2d9ee
wip dcf et 2 bit
kanav99 Aug 2, 2023
a73c40e
minor
kanav99 Aug 2, 2023
1917e74
dcf 2et done, seems little slow
kanav99 Aug 2, 2023
3b17210
benchmark code in dcftest
kanav99 Aug 2, 2023
3dbc9b7
rename
kanav99 Aug 3, 2023
b7a74db
dcfet wrapper
kanav99 Aug 3, 2023
969fa9a
dcfet1 replaced in Relu2Round and MaxpoolDouble
kanav99 Aug 3, 2023
996d55d
dcfet2 in ReluExt
kanav99 Aug 3, 2023
d04ffba
dcfet1 in SignExtend2
kanav99 Aug 3, 2023
f46816b
add greater than support in dcfet1
kanav99 Aug 3, 2023
20bcb54
new orca str
kanav99 Aug 6, 2023
82fa741
use secure STR
kanav99 Aug 7, 2023
5b205f5
secret sharing based truncation
kanav99 Aug 10, 2023
09e191e
some bugs fixed
kanav99 Aug 11, 2023
e78f173
minor
kanav99 Aug 11, 2023
cbe8fe1
microbenchmark for RT
kanav99 Aug 15, 2023
8725316
rtm microbenchmark script
kanav99 Aug 15, 2023
5477ae1
Minor Changes Timing improvements with std::thread
trajore Sep 1, 2023
876fd0a
Update sytorchBackendRep.py
trajore Sep 1, 2023
8af3668
module.h fix
trajore Sep 4, 2023
f4d9919
fix module.h bug type casting
trajore Sep 4, 2023
ef06ca2
fixed bug in llama_base.h, input_prng.cpp, module.h, tensor.h
trajore Sep 4, 2023
4c08c32
ramdisk_path option added to llama config file
trajore Sep 4, 2023
7771631
added the ramdrive scripts
trajore Sep 4, 2023
fefdb40
Update Toy example- single inference.md
trajore Sep 4, 2023
847cb3f
commented out print statements in comms.cpp
trajore Sep 12, 2023
3382240
Merge branch 'master' of https://github.com/trajore/EzPC-1
trajore Sep 12, 2023
790c151
fix bug in llama/comms.cpp
trajore Sep 12, 2023
9fef89d
fix to mult_key
trajore Sep 12, 2023
1db9c13
Updated FixtoFloats. work in progress
trajore Sep 14, 2023
4c9ec8a
updated flaot to fix, a few more bugs to fix
trajore Sep 15, 2023
ff7a964
float to fix working
trajore Sep 25, 2023
135e67f
changed the random ge to be a random element again
trajore Sep 26, 2023
5d9b7ba
working fix (initialization)
trajore Oct 10, 2023
6642c7d
float to fix corrected
trajore Oct 10, 2023
2f5d985
removed debugging statements
trajore Oct 10, 2023
93974f1
added the add function for mix bitwidth
trajore Nov 7, 2023
098395d
Update float.cpp
trajore Nov 10, 2023
f9d6085
Update api.cpp
trajore Nov 10, 2023
5b59e54
Update api.cpp
trajore Nov 10, 2023
e31fde2
Merge pull request #8 from trajore/early_term
trajore Nov 17, 2023
2965bf3
removed add mixbitwidth temporary changes
trajore Dec 11, 2023
4efa831
Merge branch 'early_term' of https://github.com/trajore/sytorch into …
trajore Dec 11, 2023
d03dd74
Merge pull request #9 from trajore/early_term
trajore Dec 18, 2023
37c6d71
Merge branch 'mpc-msri:master' into master
trajore Dec 27, 2023
7376d28
Merge remote-tracking branch 'kanav_sytorch/early_term' into orca_syt…
trajore Dec 27, 2023
a6b4cb3
Update float.cpp
trajore Jan 2, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
29 changes: 29 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,32 @@ SEAL
*.dot
*.csv
*.out
.vscode/
*.out
release/
debug/
datatorch/
client.dat
server.dat
out.folded
out.perf
perf.data
perf.data.old
graph.svg
.venv
*.dat
logs/
temp/
graph.dot
graph.png
venv/
thread_outputs/
CMakeFiles/
Makefile
*.cmake
main
CMakeCache.txt
lib
libsytorch.a
libcryptoTools.a
libLLAMA.a
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,6 @@
[submodule "CrypTFlow2/extern/eigen"]
path = SCI/extern/eigen
url = https://gitlab.com/libeigen/eigen
[submodule "ext/sci/extern/SEAL"]
path = ext/sci/extern/SEAL
url = https://github.com/Microsoft/SEAL
105 changes: 105 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
cmake_minimum_required(VERSION 3.16)
project(sytorch)

if(APPLE)

if(CMAKE_C_COMPILER_ID MATCHES "Clang\$")
set(OpenMP_C_FLAGS "-Xpreprocessor -fopenmp")
set(OpenMP_C_LIB_NAMES "omp")
set(OpenMP_omp_LIBRARY omp)
endif()

if(CMAKE_CXX_COMPILER_ID MATCHES "Clang\$")
set(OpenMP_CXX_FLAGS "-Xpreprocessor -fopenmp")
set(OpenMP_CXX_LIB_NAMES "omp")
set(OpenMP_omp_LIBRARY omp)
endif()

endif()

set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-write-strings -Wno-unused-result -maes -Wno-ignored-attributes -march=native -Wno-deprecated-declarations -fopenmp")
find_package (Eigen3 3.3 REQUIRED NO_MODULE)
find_package(Threads REQUIRED)

add_subdirectory(ext/cryptoTools)
add_subdirectory(ext/sci)
add_subdirectory(ext/llama)

add_library(${PROJECT_NAME} STATIC)
target_sources(${PROJECT_NAME}
PRIVATE
src/sytorch/datasets/mnist.cpp
src/sytorch/random.cpp
src/sytorch/train.cpp
src/sytorch/networks.cpp
src/sytorch/backend/cleartext.cpp
)

target_include_directories(${PROJECT_NAME}
PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>
)

target_link_libraries (${PROJECT_NAME} Eigen3::Eigen Threads::Threads SCI-FloatML LLAMA cryptoTools)

add_executable(main
main.cpp
)
target_link_libraries (main ${PROJECT_NAME})

add_executable(module
module.cpp
)
target_link_libraries (module ${PROJECT_NAME})

add_executable(vgg16
vgg16.cpp
)
target_link_libraries (vgg16 ${PROJECT_NAME})

add_executable(chexpert
chexpert.cpp
)
target_link_libraries (chexpert ${PROJECT_NAME})

add_executable(resnet18
resnet18.cpp
)
target_link_libraries (resnet18 ${PROJECT_NAME})

add_executable(inference
inference.cpp
)
target_link_libraries (inference ${PROJECT_NAME})

add_executable(resnet18_acc
resnet18_acc.cpp
)
target_link_libraries (resnet18_acc ${PROJECT_NAME})

add_executable(dcftest
dcftest.cpp
)
target_link_libraries (dcftest ${PROJECT_NAME})

add_executable(strtest
strtest.cpp
)
target_link_libraries (strtest ${PROJECT_NAME})

add_executable(orcav2_exp
orcav2_exp.cpp
)
target_link_libraries (orcav2_exp ${PROJECT_NAME})

add_executable(microbenchmark_rt
microbenchmark_rt.cpp
)
target_link_libraries (microbenchmark_rt ${PROJECT_NAME})

add_executable(microbenchmark_rtm
microbenchmark_rtm.cpp
)
target_link_libraries (microbenchmark_rtm ${PROJECT_NAME})
4 changes: 2 additions & 2 deletions OnnxBridge/backend.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
"""
Authors: Saksham Gupta.
Authors: Saksham Gupta,Tanmay Rajore
Copyright:
Copyright (c) 2021 Microsoft Research
Copyright (c) 2023 Microsoft Research
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
Expand Down
2 changes: 1 addition & 1 deletion OnnxBridge/helper/convert_np_to_float_inp.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,4 +66,4 @@ def convert_np_to_floatpt(path_to_numpy_arr):
args = parse_args()

output_path = convert_np_to_floatpt(args.inp)
print("FLoat point output saved in ", output_path)
print("FLoat point output saved in ", output_path)
2 changes: 1 addition & 1 deletion OnnxBridge/helper/run_onnx.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@

if __name__ == "__main__":
input_np_arr = np.load(sys.argv[2], allow_pickle=True)
sess = rt.InferenceSession(sys.argv[1])
sess = rt.InferenceSession(sys.argv[1]) #"../onnx_new_files/lenet.onnx"
input_name = sess.get_inputs()[0].name
pred_onx = sess.run(None, {input_name: input_np_arr})[0]
# print("Output:\n", pred_onx.flatten())
Expand Down
1 change: 0 additions & 1 deletion OnnxBridge/utils/optimizations.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@
from onnx import shape_inference
from onnx.helper import make_tensor_value_info
from onnxsim import simplify

from utils import logger
from utils.onnx2IR_helper import proto_val_to_dimension_tuple

Expand Down
130 changes: 52 additions & 78 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,78 +1,52 @@
# EzPC: Easy Secure Multiparty Computation [![contributions welcome](https://img.shields.io/badge/contributions-welcome-brightgreen.svg?style=flat)](https://github.com/mpc-msri/EzPC/issues)

**Reference Papers:**

[SIGMA: Secure GPT Inference with Function Secret Sharing](https://eprint.iacr.org/2023/1269)
Kanav Gupta, Neha Jawalkar, Ananta Mukherjee, Nishanth Chandran, Divya Gupta, Ashish Panwar, Rahul Sharma

[Orca: FSS-based Secure Training with GPUs](https://eprint.iacr.org/2023/206)
Neha Jawalkar, Kanav Gupta, Arkaprava Basu, Nishanth Chandran, Divya Gupta, Rahul Sharma

[Secure Floating-Point Training](https://eprint.iacr.org/2023/467)
Deevashwer Rathee, Anwesh Bhattacharya, Divya Gupta, Rahul Sharma, Dawn Song
*USENIX Security 2023*

[SecFloat: Accurate Floating-Point meets Secure 2-Party Computation](https://eprint.iacr.org/2022/322)
Deevashwer Rathee, Anwesh Bhattacharya, Rahul Sharma, Divya Gupta, Nishanth Chandran, Aseem Rastogi
*IEEE S&P 2022*

[SIRNN: A Math Library for Secure RNN Inference](https://eprint.iacr.org/2021/459)
Deevashwer Rathee, Mayank Rathee, Rahul Kranti Kiran Goli, Divya Gupta, Rahul Sharma, Nishanth Chandran, Aseem Rastogi
*IEEE S&P 2021*

[CrypTFlow2: Practical 2-Party Secure Inference](https://eprint.iacr.org/2020/1002)
Deevashwer Rathee, Mayank Rathee, Nishant Kumar, Nishanth Chandran, Divya Gupta, Aseem Rastogi, Rahul Sharma
*ACM CCS 2020*

[CrypTFlow: Secure TensorFlow Inference](https://eprint.iacr.org/2019/1049)
Nishant Kumar, Mayank Rathee, Nishanth Chandran, Divya Gupta, Aseem Rastogi, Rahul Sharma
*IEEE S&P 2020*

[EzPC: Programmable, Efficient, and Scalable Secure Two-Party Computation for Machine Learning](https://eprint.iacr.org/2017/1109.pdf)
Nishanth Chandran, Divya Gupta, Aseem Rastogi, Rahul Sharma, Shardul Tripathi
*IEEE EuroS&P 2019*

**Project webpage:** <https://aka.ms/ezpc>

## Introduction
This repository has the following components:

- **EzPC**: a language for secure machine learning.
- **Athos** (part of **CrypTFlow**): an end-to-end compiler from TensorFlow to a variety of semi-honest MPC protocols. Athos leverages EzPC as a low-level intermediate language.
- **SIRNN**: an end-to-end framework for performing inference over quantized RNN models using semi-honest 2-party computation protocols.
- **Beacon**: an end-to-end framework for training feed-forward and convolutional neural networks using specialized 2PC floating-point protocols
- **Porthos** (part of **CrypTFlow**): a semi-honest 3 party computation protocol which is geared towards TensorFlow-like applications.
- **Aramis** (part of **CrypTFlow**): a novel technique that uses hardware with integrity guarantees to convert any semi-honest MPC protocol into an MPC protocol that provides malicious security.
- **SCI** (part of **CrypTFlow2**, **SIRNN**, **SecFloat**, and **Beacon**): a semi-honest 2-party computation library for secure (fixed-point) inference on deep neural networks and secure floating-point computation.

Each one of the above is independent and usable in their own right and more information can be found in the readme of each of the components. But together these combine to make **CrypTFlow** a powerful system for end-to-end secure inference of deep neural networks written in TensorFlow.

With these components in place, we are able to run for the first time secure inference on the [ImageNet dataset]([http://www.image-net.org) with the pre-trained models of the following deep neural nets: ResNet-50, DenseNet-121 and SqueezeNet for ImageNet. For an end-to-end tutorial on running models with CrypTFlow please refer to this [blog post](https://pratik-bhatu.medium.com/privacy-preserving-machine-learning-for-healthcare-using-cryptflow-cc6c379fbab7).

## Setup
For setup instructions, please refer to each of the components' readme.

Alternatively you can use the **setup_env_and_build.sh** script. It installs dependencies and builds each component. It also creates a virtual environment in a *mpc_venv* folder with all the required packages. If you want to do setup with default paths and settings do ``./setup_env_and_build.sh quick``, otherwise if you want to manually choose paths you can use ``./setup_env_and_build.sh``.

Please do ``source mpc_venv/bin/activate`` before using the toolchain.

## Secure AI Validation

To setup the repo with modified SCI build such that only secret shares are revealed at the end of 2PC, run the setup script as ``./setup_env_and_build.sh quick NO_REVEAL_OUTPUT``.
Alternatively, just rebuild SCI. For instructions to build modified SCI, see README for SCI.

To build docker image for Secure AI Validation, use the `Dockerfile_AI_Validation` dockerfile.

```docker build -t ezpc_modified - < path/to/EzPC/Dockerfile_AI_Validation```


### Docker
You can use a pre-built docker image from docker hub using ``docker pull ezpc/ezpc:latest``. We occasionally push stable images to that channel. However, if you want a docker image with the latest code, you can build it yourself using:

```docker build -t ezpc_image - < path/to/EzPC/Dockerfile```

## Wiki
Wiki section of this repository provides coding practices and examples to get started with EzPC.

## Issues/Bugs
For bugs and support, please create an issue on the issues page.
# Sytorch

This GitHub repository contains a script that runs a secure Multi-Party Computation (MPC) model to process an image. The script requires certain arguments to be set in order to run correctly.

## Prerequisites
Before running the script, ensure that you have the following:
- The MPC model file in ONNX format
- The image file to be processed in JPG format
- The preprocess.py file to preprocess the image
- The IP address of the server
- Further server and client IP should be whitelisted so they cam communicate over TCP/IP Protocol.

We require the below packages to run OnnxBridge.
- onnx==1.12.0
- onnxruntime==1.12.1
- onnxsim==0.4.8
- numpy==1.21.0
- protobuf==3.20.1
- torchvision==0.13.1
- idx2numpy==1.2.3

Above dependencies can be installed using the [requirements.txt](OnnxBridge/requirements.txt) file as below:
```bash
pip3 install -r OnnxBridge/requirements.txt
```

## Required Arguments
The script requires the following arguments to be set:
- `MODEL_PATH`: the full path to the ONNX MPC model file
- `IMAGE_PATH`: the full path to the input image file
- `PREPROCESS`: the full path to the preprocess.py file
- `SERVER_IP`: the IP address of the server

If any of these arguments are not set, the script will display an error message and exit.

## Optional Arguments
The script also supports the following optional arguments:
- `-b <backend>`: the MPC backend to use (default: `LLAMA`)
- `-scale <scale>`: the scaling factor for the model input (default: `15`)
- `-bl <bitlength>`: the bitlength to use for the MPC computation (default: `40`)

## Running the Script
To run the script, use the following command:
```bash
./ezpc-cli.sh -m <full-path/model.onnx> -preprocess <full-path/preprocess_image_file> -s <server-ip> -i <full-path/image>
```
The above script only works to generate steps for server and client in form of a bash script,
which can be then run on two VM having Server and Client files respectively.
This script generates :
- server.sh -> For server machine and can be run directly using ```./server.sh```.
- ```server.sh``` also generates ```client_model.zip``` which needs to be sent to client VM in the same folder where ```client.sh``` will be executed.
- client.sh -> For client machine and can be run directly using ```./client.sh```.
Loading