diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index bbe3fee7..c8fa350a 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -55,7 +55,6 @@ jobs: library-tests: runs-on: ubuntu-latest - steps: - uses: actions/checkout@v3 - uses: actions-rs/toolchain@v1 @@ -69,11 +68,9 @@ jobs: run: cargo test --lib --verbose mock-proving-tests: - runs-on: ubuntu-latest + runs-on: ubuntu-latest-32-cores steps: - uses: actions/checkout@v3 - with: - submodules: recursive - uses: actions-rs/toolchain@v1 with: toolchain: nightly @@ -81,24 +78,21 @@ jobs: components: rustfmt, clippy - name: Mock proving tests (public outputs) - run: cargo test --release --verbose tests::mock_public_outputs_ -- --test-threads 16 + run: cargo test --release --verbose tests::mock_public_outputs_ -- --test-threads 32 - name: Mock proving tests (public inputs) - run: cargo test --release --verbose tests::mock_public_inputs_ -- --test-threads 16 + run: cargo test --release --verbose tests::mock_public_inputs_ -- --test-threads 32 - name: Mock proving tests (public params) - run: cargo test --release --verbose tests::mock_public_params_ -- --test-threads 16 + run: cargo test --release --verbose tests::mock_public_params_ -- --test-threads 32 prove-and-verify-evm-tests: runs-on: ubuntu-latest-16-cores steps: - uses: actions/checkout@v3 - with: - submodules: recursive - uses: actions-rs/toolchain@v1 with: toolchain: nightly override: true components: rustfmt, clippy - - name: Install solc run: (hash svm 2>/dev/null || cargo install svm-rs) && svm install 0.8.17 && solc --version - name: Install Anvil @@ -110,14 +104,11 @@ jobs: runs-on: ubuntu-latest-16-cores steps: - uses: actions/checkout@v3 - with: - submodules: recursive - uses: actions-rs/toolchain@v1 with: toolchain: nightly override: true components: rustfmt, clippy - - name: KZG prove and verify tests run: cargo test --release --verbose tests::kzg_prove_and_verify_ -- --test-threads 4 @@ -125,23 +116,18 @@ jobs: runs-on: self-hosted steps: - uses: actions/checkout@v3 - with: - submodules: recursive - uses: actions-rs/toolchain@v1 with: toolchain: nightly override: true components: rustfmt, clippy - - name: KZG prove and verify aggr tests - run: cargo test --release --verbose tests_aggr::kzg_aggr_prove_and_verify_ -- --test-threads 4 + run: cargo test --release --verbose tests_aggr::kzg_aggr_prove_and_verify_ - prove-and-verify-evm-aggr-tests: + prove-and-verify-aggr-evm-tests: runs-on: self-hosted steps: - uses: actions/checkout@v3 - with: - submodules: recursive - uses: actions-rs/toolchain@v1 with: toolchain: nightly @@ -150,10 +136,10 @@ jobs: - name: Install solc run: (hash svm 2>/dev/null || cargo install svm-rs) && svm install 0.8.17 && solc --version - name: KZG prove and verify aggr tests - run: cargo test --release --verbose tests_evm::kzg_evm_aggr_prove_and_verify_ -- --test-threads 4 --include-ignored + run: cargo test --release --verbose tests_evm::kzg_evm_aggr_prove_and_verify_ -- --include-ignored examples: - runs-on: self-hosted + runs-on: ubuntu-latest-32-cores steps: - uses: actions/checkout@v3 - uses: actions-rs/toolchain@v1 @@ -171,13 +157,10 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 - with: - submodules: recursive - uses: actions-rs/toolchain@v1 with: toolchain: nightly override: true components: rustfmt, clippy - - name: Mock proving tests (should fail) run: cargo test neg_tests::neg_examples_ diff --git a/.gitmodules b/.gitmodules deleted file mode 100644 index 231ba93d..00000000 --- a/.gitmodules +++ /dev/null @@ -1,4 +0,0 @@ -[submodule "examples/onnx"] - path = examples/onnx - url = https://github.com/zkonduit/onnx-examples - branch = main diff --git a/README.md b/README.md index 8e45d5e3..aa61c055 100644 --- a/README.md +++ b/README.md @@ -46,8 +46,6 @@ Note that the library requires a nightly version of the rust toolchain. You can rustup override set nightly ``` -This repository includes onnx example files as a submodule for testing out the cli. Either pass the `--recurse-submodules` flag to the `clone` command or after cloning run `git submodule update --init --recursive`. - ### docs 📖 Use `cargo doc --open` to compile and open the docs in your default browser. @@ -64,26 +62,26 @@ The `ezkl` cli provides a simple interface to load `.onnx` files, which represen You can easily create an `.onnx` file using `pytorch`. For samples of Onnx files see [here](https://github.com/zkonduit/onnx-examples). For a tutorial on how to quickly generate Onnx files using python, check out [pyezkl](https://github.com/zkonduit/pyezkl). -These examples are also available as a submodule in `./examples/onnx`. To generate a proof on one of the examples, first build ezkl (`cargo build --release`) and add it to your favourite `PATH` variables, then generate a structured reference string (SRS): +Sample onnx files are also available in `./examples/onnx`. To generate a proof on one of the examples, first build ezkl (`cargo build --release`) and add it to your favourite `PATH` variables, then generate a structured reference string (SRS): ```bash ezkl -K=17 gen-srs --pfsys=kzg --params-path=kzg.params ``` ```bash -ezkl --bits=16 -K=17 prove -D ./examples/onnx/examples/1l_relu/input.json -M ./examples/onnx/examples/1l_relu/network.onnx --proof-path 1l_relu.pf --vk-path 1l_relu.vk --params-path=kzg.params +ezkl --bits=16 -K=17 prove -D ./examples/onnx/1l_relu/input.json -M ./examples/onnx/1l_relu/network.onnx --proof-path 1l_relu.pf --vk-path 1l_relu.vk --params-path=kzg.params ``` This command generates a proof that the model was correctly run on private inputs (this is the default setting). It then outputs the resulting proof at the path specfifed by `--proof-path`, parameters that can be used for subsequent verification at `--params-path` and the verifier key at `--vk-path`. Luckily `ezkl` also provides command to verify the generated proofs: ```bash -ezkl --bits=16 -K=17 verify -M ./examples/onnx/examples/1l_relu/network.onnx --proof-path 1l_relu.pf --vk-path 1l_relu.vk --params-path=kzg.params +ezkl --bits=16 -K=17 verify -M ./examples/onnx/1l_relu/network.onnx --proof-path 1l_relu.pf --vk-path 1l_relu.vk --params-path=kzg.params ``` To display a table of the loaded onnx nodes, their associated parameters, set `RUST_LOG=DEBUG` or run: ```bash -cargo run --release --bin ezkl -- table -M ./examples/onnx/examples/1l_relu/network.onnx +cargo run --release --bin ezkl -- table -M ./examples/onnx/1l_relu/network.onnx ``` @@ -93,11 +91,11 @@ Note that the above prove and verify stats can also be run with an EVM verifier. ```bash # gen proof -ezkl --bits=16 -K=17 prove -D ./examples/onnx/examples/1l_relu/input.json -M ./examples/onnx/examples/1l_relu/network.onnx --proof-path 1l_relu.pf --vk-path 1l_relu.vk --params-path=kzg.params --transcript=evm +ezkl --bits=16 -K=17 prove -D ./examples/onnx/1l_relu/input.json -M ./examples/onnx/1l_relu/network.onnx --proof-path 1l_relu.pf --vk-path 1l_relu.vk --params-path=kzg.params --transcript=evm ``` ```bash # gen evm verifier -ezkl -K=17 --bits=16 create-evm-verifier -D ./examples/onnx/examples/1l_relu/input.json -M ./examples/onnx/examples/1l_relu/network.onnx --pfsys=kzg --deployment-code-path 1l_relu.code --params-path=kzg.params --vk-path 1l_relu.vk --sol-code-path 1l_relu.sol +ezkl -K=17 --bits=16 create-evm-verifier -D ./examples/onnx/1l_relu/input.json -M ./examples/onnx/1l_relu/network.onnx --pfsys=kzg --deployment-code-path 1l_relu.code --params-path=kzg.params --vk-path 1l_relu.vk --sol-code-path 1l_relu.sol ``` ```bash # Verify (EVM) @@ -115,12 +113,12 @@ ezkl -K=20 gen-srs --pfsys=kzg --params-path=kzg.params ```bash # Single proof -> single proof we are going to feed into aggregation circuit. (Mock)-verifies + verifies natively as sanity check -ezkl -K=17 --bits=16 prove --pfsys=kzg --transcript=poseidon --strategy=accum -D ./examples/onnx/examples/1l_relu/input.json -M ./examples/onnx/examples/1l_relu/network.onnx --proof-path 1l_relu.pf --params-path=kzg.params --vk-path=1l_relu.vk +ezkl -K=17 --bits=16 prove --pfsys=kzg --transcript=poseidon --strategy=accum -D ./examples/onnx/1l_relu/input.json -M ./examples/onnx/1l_relu/network.onnx --proof-path 1l_relu.pf --params-path=kzg.params --vk-path=1l_relu.vk ``` ```bash # Aggregate -> generates aggregate proof and also (mock)-verifies + verifies natively as sanity check -ezkl -K=17 --bits=16 aggregate --transcript=evm -M ./examples/onnx/examples/1l_relu/network.onnx --pfsys=kzg --aggregation-snarks=1l_relu.pf --aggregation-vk-paths 1l_relu.vk --vk-path aggr_1l_relu.vk --proof-path aggr_1l_relu.pf --params-path=kzg.params +ezkl -K=17 --bits=16 aggregate --transcript=evm -M ./examples/onnx/1l_relu/network.onnx --pfsys=kzg --aggregation-snarks=1l_relu.pf --aggregation-vk-paths 1l_relu.vk --vk-path aggr_1l_relu.vk --proof-path aggr_1l_relu.pf --params-path=kzg.params ``` ```bash @@ -219,6 +217,18 @@ criterion_group! { } ``` +## onnx examples + +This repository includes onnx example files as a submodule for testing out the cli. + +If you want to add a model to `examples/onnx`, open a PR creating a new folder within `examples/onnx` with a descriptive model name. This folder should contain: +- an `input.json` input file, with the fields expected by the [ezkl](https://github.com/zkonduit/ezkl) cli. +- a `network.onnx` file representing the trained model +- a `gen.py` file for generating the `.json` and `.onnx` files following the general structure of `examples/tutorial/tutorial.py`. + + +TODO: add associated python files in the onnx model directories. + ## library examples 🔍 Beyond the `.onnx` examples detailed above, we also include examples which directly use some of our rust API; allowing users to code up computational graphs and circuits from scratch in rust without having to go via python. diff --git a/examples/onnx b/examples/onnx deleted file mode 160000 index b1cee58c..00000000 --- a/examples/onnx +++ /dev/null @@ -1 +0,0 @@ -Subproject commit b1cee58c048fe94dccccaa9de4d528c38e2b68e3 diff --git a/examples/onnx/1l_average/input.json b/examples/onnx/1l_average/input.json new file mode 100644 index 00000000..eba05fe0 --- /dev/null +++ b/examples/onnx/1l_average/input.json @@ -0,0 +1,51 @@ +{ + "input_shapes": [ + [ + 1, + 5, + 5 + ] + ], + "input_data": [ + [ + 0.1, + 0.1, + 0.1, + 0.1, + 0.1, + 0.1, + 0.1, + 0.1, + 0.1, + 0.1, + 0.1, + 0.1, + 0.1, + 0.1, + 0.1, + 0.1, + 0.1, + 0.1, + 0.1, + 0.1, + 0.1, + 0.1, + 0.1, + 0.1, + 0.1 + ] + ], + "output_data": [ + [ + 0.914, + 0.914, + 0.914, + 0.914, + 0.914, + 0.914, + 0.914, + 0.914, + 0.914 + ] + ] +} \ No newline at end of file diff --git a/examples/onnx/1l_average/network.onnx b/examples/onnx/1l_average/network.onnx new file mode 100644 index 00000000..9fdf636d Binary files /dev/null and b/examples/onnx/1l_average/network.onnx differ diff --git a/examples/onnx/1l_conv/gen.py b/examples/onnx/1l_conv/gen.py new file mode 100644 index 00000000..63d159e5 --- /dev/null +++ b/examples/onnx/1l_conv/gen.py @@ -0,0 +1,16 @@ +from torch import nn +from ezkl import export + +class Model(nn.Module): + def __init__(self): + super(Model, self).__init__() + self.layer = nn.Conv2d(3, 1, (1, 1), 1, 1) + + def forward(self, x): + return self.layer(x) + +circuit = Model() +export(circuit, input_shape = [3, 1, 1]) + + + diff --git a/examples/onnx/1l_conv/input.json b/examples/onnx/1l_conv/input.json new file mode 100644 index 00000000..6b141d00 --- /dev/null +++ b/examples/onnx/1l_conv/input.json @@ -0,0 +1,30 @@ +{ + "input_shapes": [ + [ + 3, + 1, + 1 + ] + ], + "input_data": [ + [ + 0.011350071988999844, + 0.03404385969042778, + 0.04626564309000969 + ] + ], + "output_data": [ + [ + -0.36590576171875, + -0.36590576171875, + -0.36590576171875, + -0.36590576171875, + -0.3919677734375, + -0.36590576171875, + -0.36590576171875, + -0.36590576171875, + -0.36590576171875 + ] + ] +} + diff --git a/examples/onnx/1l_conv/network.onnx b/examples/onnx/1l_conv/network.onnx new file mode 100644 index 00000000..e132e331 --- /dev/null +++ b/examples/onnx/1l_conv/network.onnx @@ -0,0 +1,27 @@ +pytorch1.13.1: + +input + layer.weight + +layer.biasoutput /layer/Conv"Conv* + dilations@@* +group* + kernel_shape@@* +pads@@@@* +strides@@ torch_jit*&B layer.weightJ (F +վ*B +layer.biasJPWZ) +input + +  +batch_size + + +b* +output + +  +batch_size + + +B diff --git a/examples/onnx/1l_flatten/gen.py b/examples/onnx/1l_flatten/gen.py new file mode 100644 index 00000000..37612d5b --- /dev/null +++ b/examples/onnx/1l_flatten/gen.py @@ -0,0 +1,50 @@ +import io +import numpy as np +from torch import nn +import torch.onnx +import torch.nn as nn +import torch.nn.init as init +import json + +class Circuit(nn.Module): + def __init__(self): + super(Circuit, self).__init__() + self.flatten = nn.Flatten() + + def forward(self, x): + return self.flatten(x) + + + +def main(): + torch_model = Circuit() + # Input to the model + shape = [3, 2, 3] + x = 0.1*torch.rand(1,*shape, requires_grad=True) + torch_out = torch_model(x) + # Export the model + torch.onnx.export(torch_model, # model being run + x, # model input (or a tuple for multiple inputs) + "network.onnx", # where to save the model (can be a file or file-like object) + export_params=True, # store the trained parameter weights inside the model file + opset_version=10, # the ONNX version to export the model to + do_constant_folding=True, # whether to execute constant folding for optimization + input_names = ['input'], # the model's input names + output_names = ['output'], # the model's output names + dynamic_axes={'input' : {0 : 'batch_size'}, # variable length axes + 'output' : {0 : 'batch_size'}}) + + d = ((x).detach().numpy()).reshape([-1]).tolist() + + data = dict(input_shapes = [shape, shape, shape], + input_data = [d], + output_data = [((o).detach().numpy()).reshape([-1]).tolist() for o in torch_out]) + + # Serialize data into file: + json.dump( data, open( "input.json", 'w' ) ) + +if __name__ == "__main__": + main() + + + diff --git a/examples/onnx/1l_flatten/input.json b/examples/onnx/1l_flatten/input.json new file mode 100644 index 00000000..541e1fd7 --- /dev/null +++ b/examples/onnx/1l_flatten/input.json @@ -0,0 +1,63 @@ +{ + "input_shapes": [ + [ + 3, + 2, + 3 + ], + [ + 3, + 2, + 3 + ], + [ + 3, + 2, + 3 + ] + ], + "input_data": [ + [ + 0.024982912465929985, + 0.09144836664199829, + 0.009130030870437622, + 0.010118866339325905, + 0.08052441477775574, + 0.005395460408180952, + 0.0011400461662560701, + 0.07372475415468216, + 0.023353761062026024, + 0.05521431565284729, + 0.09113214910030365, + 0.04682333394885063, + 0.007070374675095081, + 0.03275662660598755, + 0.013910329900681973, + 0.06051855906844139, + 0.05030276998877525, + 0.002268546959385276 + ] + ], + "output_data": [ + [ + 0.024982912465929985, + 0.09144836664199829, + 0.009130030870437622, + 0.010118866339325905, + 0.08052441477775574, + 0.005395460408180952, + 0.0011400461662560701, + 0.07372475415468216, + 0.023353761062026024, + 0.05521431565284729, + 0.09113214910030365, + 0.04682333394885063, + 0.007070374675095081, + 0.03275662660598755, + 0.013910329900681973, + 0.06051855906844139, + 0.05030276998877525, + 0.002268546959385276 + ] + ] +} \ No newline at end of file diff --git a/examples/onnx/1l_flatten/network.onnx b/examples/onnx/1l_flatten/network.onnx new file mode 100644 index 00000000..913402d6 --- /dev/null +++ b/examples/onnx/1l_flatten/network.onnx @@ -0,0 +1,16 @@ +pytorch1.12.1: +0 +inputoutput Flatten_0"Flatten* +axis torch_jitZ) +input + +  +batch_size + + +b" +output + +  +batch_size +B diff --git a/examples/onnx/1l_leakyrelu/gen.py b/examples/onnx/1l_leakyrelu/gen.py new file mode 100644 index 00000000..a2aa2a6d --- /dev/null +++ b/examples/onnx/1l_leakyrelu/gen.py @@ -0,0 +1,16 @@ +from torch import nn +from ezkl import export + +class Model(nn.Module): + def __init__(self): + super(Model, self).__init__() + self.layer = nn.LeakyReLU(negative_slope=0.05) + + def forward(self, x): + return self.layer(x) + +circuit = Model() +export(circuit, input_shape = [3]) + + + diff --git a/examples/onnx/1l_leakyrelu/input.json b/examples/onnx/1l_leakyrelu/input.json new file mode 100644 index 00000000..cb04e8a4 --- /dev/null +++ b/examples/onnx/1l_leakyrelu/input.json @@ -0,0 +1,21 @@ +{ + "input_shapes": [ + [ + 3 + ] + ], + "input_data": [ + [ + 0.06149055436253548, + 0.04009602218866348, + 0.027487868443131447 + ] + ], + "output_data": [ + [ + 0.06149055436253548, + 0.04009602218866348, + 0.027487868443131447 + ] + ] +} \ No newline at end of file diff --git a/examples/onnx/1l_leakyrelu/network.onnx b/examples/onnx/1l_leakyrelu/network.onnx new file mode 100644 index 00000000..3467c8b4 --- /dev/null +++ b/examples/onnx/1l_leakyrelu/network.onnx @@ -0,0 +1,14 @@ +pytorch1.12.1: +8 +inputoutput LeakyRelu_0" LeakyRelu* +alphaL= torch_jitZ! +input + +  +batch_size +b" +output + +  +batch_size +B diff --git a/examples/onnx/1l_mlp/input.json b/examples/onnx/1l_mlp/input.json new file mode 100644 index 00000000..af5f078a --- /dev/null +++ b/examples/onnx/1l_mlp/input.json @@ -0,0 +1,22 @@ +{ + "input_shapes": [ + [ + 3 + ] + ], + "input_data": [ + [ + 1.54172945022583, + 0.5346152782440186, + 1.2172532081604004 + ] + ], + "output_data": [ + [ + 0.28125, + 0.6484375, + 0.0, + 0.0 + ] + ] +} diff --git a/examples/onnx/1l_mlp/network.onnx b/examples/onnx/1l_mlp/network.onnx new file mode 100644 index 00000000..3e22eb07 Binary files /dev/null and b/examples/onnx/1l_mlp/network.onnx differ diff --git a/examples/onnx/1l_prelu/gen.py b/examples/onnx/1l_prelu/gen.py new file mode 100644 index 00000000..f479cf1f --- /dev/null +++ b/examples/onnx/1l_prelu/gen.py @@ -0,0 +1,16 @@ +from torch import nn +from ezkl import export + +class Model(nn.Module): + def __init__(self): + super(Model, self).__init__() + self.layer = nn.PReLU(num_parameters=3, init=0.25) + + def forward(self, x): + return self.layer(x) + +circuit = Model() +export(circuit, input_shape = [3, 2, 2]) + + + diff --git a/examples/onnx/1l_prelu/input.json b/examples/onnx/1l_prelu/input.json new file mode 100644 index 00000000..0662ef8c --- /dev/null +++ b/examples/onnx/1l_prelu/input.json @@ -0,0 +1,41 @@ +{ + "input_shapes": [ + [ + 3, + 2, + 2 + ] + ], + "input_data": [ + [ + 0.024342495948076248, + 0.04569540172815323, + 0.07267124205827713, + 0.013060438446700573, + 0.09049484878778458, + 0.023895228281617165, + 0.06646782904863358, + 0.005524409003555775, + 0.08089068531990051, + 0.0037329555489122868, + 0.065357506275177, + 0.04939475655555725 + ] + ], + "output_data": [ + [ + 0.024342495948076248, + 0.04569540172815323, + 0.07267124205827713, + 0.013060438446700573, + 0.09049484878778458, + 0.023895228281617165, + 0.06646782904863358, + 0.005524409003555775, + 0.08089068531990051, + 0.0037329555489122868, + 0.065357506275177, + 0.04939475655555725 + ] + ] +} \ No newline at end of file diff --git a/examples/onnx/1l_prelu/network.onnx b/examples/onnx/1l_prelu/network.onnx new file mode 100644 index 00000000..dfaec3c5 Binary files /dev/null and b/examples/onnx/1l_prelu/network.onnx differ diff --git a/examples/onnx/1l_relu/gen.py b/examples/onnx/1l_relu/gen.py new file mode 100644 index 00000000..3615ee12 --- /dev/null +++ b/examples/onnx/1l_relu/gen.py @@ -0,0 +1,16 @@ +from torch import nn +from ezkl import export + +class MyModel(nn.Module): + def __init__(self): + super(MyModel, self).__init__() + self.layer = nn.ReLU() + + def forward(self, x): + return self.layer(x) + +circuit = MyModel() +export(circuit, input_shape = [3]) + + + diff --git a/examples/onnx/1l_relu/input.json b/examples/onnx/1l_relu/input.json new file mode 100644 index 00000000..0a6014d6 --- /dev/null +++ b/examples/onnx/1l_relu/input.json @@ -0,0 +1,21 @@ +{ + "input_shapes": [ + [ + 3 + ] + ], + "input_data": [ + [ + -0.40077725052833557, + 2.493845224380493, + 0.5796360969543457 + ] + ], + "output_data": [ + [ + 0.0, + 2.493845224380493, + 0.5796360969543457 + ] + ] +} \ No newline at end of file diff --git a/examples/onnx/1l_relu/network.onnx b/examples/onnx/1l_relu/network.onnx new file mode 100644 index 00000000..4237b60c --- /dev/null +++ b/examples/onnx/1l_relu/network.onnx @@ -0,0 +1,13 @@ +pytorch1.12.1:q + +inputoutputRelu_0"Relu torch_jitZ! +input + +  +batch_size +b" +output + +  +batch_size +B diff --git a/examples/onnx/1l_reshape/input.json b/examples/onnx/1l_reshape/input.json new file mode 100644 index 00000000..b7099b78 --- /dev/null +++ b/examples/onnx/1l_reshape/input.json @@ -0,0 +1,28 @@ +{ + "input_shapes": [ + [ + 3, + 2 + ] + ], + "input_data": [ + [ + 0.9399577379226685, + -0.1435815989971161, + -1.6204580068588257, + 0.8732473850250244, + -0.12983344495296478, + -0.1989465206861496 + ] + ], + "output_data": [ + [ + 0.9399577379226685, + -0.1435815989971161, + -1.6204580068588257, + 0.8732473850250244, + -0.12983344495296478, + -0.1989465206861496 + ] + ] +} \ No newline at end of file diff --git a/examples/onnx/1l_reshape/network.onnx b/examples/onnx/1l_reshape/network.onnx new file mode 100644 index 00000000..9513912b Binary files /dev/null and b/examples/onnx/1l_reshape/network.onnx differ diff --git a/examples/onnx/1l_sigmoid/gen.py b/examples/onnx/1l_sigmoid/gen.py new file mode 100644 index 00000000..e657cf41 --- /dev/null +++ b/examples/onnx/1l_sigmoid/gen.py @@ -0,0 +1,16 @@ +from torch import nn +from ezkl import export + +class MyModel(nn.Module): + def __init__(self): + super(MyModel, self).__init__() + self.layer = nn.Sigmoid() + + def forward(self, x): + return self.layer(x) + +circuit = MyModel() +export(circuit, input_shape = [3]) + + + diff --git a/examples/onnx/1l_sigmoid/input.json b/examples/onnx/1l_sigmoid/input.json new file mode 100644 index 00000000..e46746eb --- /dev/null +++ b/examples/onnx/1l_sigmoid/input.json @@ -0,0 +1,21 @@ +{ + "input_shapes": [ + [ + 3 + ] + ], + "input_data": [ + [ + -0.008400974795222282, + 0.18489880859851837, + -0.7444106340408325 + ] + ], + "output_data": [ + [ + 0.4978998005390167, + 0.5460934638977051, + 0.3220404088497162 + ] + ] +} \ No newline at end of file diff --git a/examples/onnx/1l_sigmoid/network.onnx b/examples/onnx/1l_sigmoid/network.onnx new file mode 100644 index 00000000..1e2a3059 --- /dev/null +++ b/examples/onnx/1l_sigmoid/network.onnx @@ -0,0 +1,13 @@ +pytorch1.12.1:w +# +inputoutput Sigmoid_0"Sigmoid torch_jitZ! +input + +  +batch_size +b" +output + +  +batch_size +B diff --git a/examples/onnx/2l_linear_conv/network.onnx b/examples/onnx/2l_linear_conv/network.onnx new file mode 100644 index 00000000..050647b2 Binary files /dev/null and b/examples/onnx/2l_linear_conv/network.onnx differ diff --git a/examples/onnx/2l_relu_conv/network.onnx b/examples/onnx/2l_relu_conv/network.onnx new file mode 100644 index 00000000..51bc409c Binary files /dev/null and b/examples/onnx/2l_relu_conv/network.onnx differ diff --git a/examples/onnx/2l_relu_sigmoid/input.json b/examples/onnx/2l_relu_sigmoid/input.json new file mode 100644 index 00000000..fe1fe2a9 --- /dev/null +++ b/examples/onnx/2l_relu_sigmoid/input.json @@ -0,0 +1,401 @@ +{ + "input_shapes": [ + [ + 3, + 8, + 8 + ] + ], + "input_data": [ + [ + 1.0, + 1.0, + 1.0, + 1.0, + 1.0, + 1.0, + 1.0, + 1.0, + 1.0, + 1.0, + 1.0, + 1.0, + 1.0, + 1.0, + 1.0, + 1.0, + 1.0, + 1.0, + 1.0, + 1.0, + 1.0, + 1.0, + 1.0, + 1.0, + 1.0, + 1.0, + 1.0, + 1.0, + 1.0, + 1.0, + 1.0, + 1.0, + 1.0, + 1.0, + 1.0, + 1.0, + 1.0, + 1.0, + 1.0, + 1.0, + 1.0, + 1.0, + 1.0, + 1.0, + 1.0, + 1.0, + 1.0, + 1.0, + 1.0, + 1.0, + 1.0, + 1.0, + 1.0, + 1.0, + 1.0, + 1.0, + 1.0, + 1.0, + 1.0, + 1.0, + 1.0, + 1.0, + 1.0, + 1.0, + 1.0, + 1.0, + 1.0, + 1.0, + 1.0, + 1.0, + 1.0, + 1.0, + 1.0, + 1.0, + 1.0, + 1.0, + 1.0, + 1.0, + 1.0, + 1.0, + 1.0, + 1.0, + 1.0, + 1.0, + 1.0, + 1.0, + 1.0, + 1.0, + 1.0, + 1.0, + 1.0, + 1.0, + 1.0, + 1.0, + 1.0, + 1.0, + 1.0, + 1.0, + 1.0, + 1.0, + 1.0, + 1.0, + 1.0, + 1.0, + 1.0, + 1.0, + 1.0, + 1.0, + 1.0, + 1.0, + 1.0, + 1.0, + 1.0, + 1.0, + 1.0, + 1.0, + 1.0, + 1.0, + 1.0, + 1.0, + 1.0, + 1.0, + 1.0, + 1.0, + 1.0, + 1.0, + 1.0, + 1.0, + 1.0, + 1.0, + 1.0, + 1.0, + 1.0, + 1.0, + 1.0, + 1.0, + 1.0, + 1.0, + 1.0, + 1.0, + 1.0, + 1.0, + 1.0, + 1.0, + 1.0, + 1.0, + 1.0, + 1.0, + 1.0, + 1.0, + 1.0, + 1.0, + 1.0, + 1.0, + 1.0, + 1.0, + 1.0, + 1.0, + 1.0, + 1.0, + 1.0, + 1.0, + 1.0, + 1.0, + 1.0, + 1.0, + 1.0, + 1.0, + 1.0, + 1.0, + 1.0, + 1.0, + 1.0, + 1.0, + 1.0, + 1.0, + 1.0, + 1.0, + 1.0, + 1.0, + 1.0, + 1.0, + 1.0, + 1.0, + 1.0, + 1.0, + 1.0, + 1.0, + 1.0, + 1.0, + 1.0, + 1.0 + ] + ], + "output_data": [ + [ + 0.7310585975646973, + 0.7310585975646973, + 0.7310585975646973, + 0.7310585975646973, + 0.7310585975646973, + 0.7310585975646973, + 0.7310585975646973, + 0.7310585975646973, + 0.7310585975646973, + 0.7310585975646973, + 0.7310585975646973, + 0.7310585975646973, + 0.7310585975646973, + 0.7310585975646973, + 0.7310585975646973, + 0.7310585975646973, + 0.7310585975646973, + 0.7310585975646973, + 0.7310585975646973, + 0.7310585975646973, + 0.7310585975646973, + 0.7310585975646973, + 0.7310585975646973, + 0.7310585975646973, + 0.7310585975646973, + 0.7310585975646973, + 0.7310585975646973, + 0.7310585975646973, + 0.7310585975646973, + 0.7310585975646973, + 0.7310585975646973, + 0.7310585975646973, + 0.7310585975646973, + 0.7310585975646973, + 0.7310585975646973, + 0.7310585975646973, + 0.7310585975646973, + 0.7310585975646973, + 0.7310585975646973, + 0.7310585975646973, + 0.7310585975646973, + 0.7310585975646973, + 0.7310585975646973, + 0.7310585975646973, + 0.7310585975646973, + 0.7310585975646973, + 0.7310585975646973, + 0.7310585975646973, + 0.7310585975646973, + 0.7310585975646973, + 0.7310585975646973, + 0.7310585975646973, + 0.7310585975646973, + 0.7310585975646973, + 0.7310585975646973, + 0.7310585975646973, + 0.7310585975646973, + 0.7310585975646973, + 0.7310585975646973, + 0.7310585975646973, + 0.7310585975646973, + 0.7310585975646973, + 0.7310585975646973, + 0.7310585975646973, + 0.7310585975646973, + 0.7310585975646973, + 0.7310585975646973, + 0.7310585975646973, + 0.7310585975646973, + 0.7310585975646973, + 0.7310585975646973, + 0.7310585975646973, + 0.7310585975646973, + 0.7310585975646973, + 0.7310585975646973, + 0.7310585975646973, + 0.7310585975646973, + 0.7310585975646973, + 0.7310585975646973, + 0.7310585975646973, + 0.7310585975646973, + 0.7310585975646973, + 0.7310585975646973, + 0.7310585975646973, + 0.7310585975646973, + 0.7310585975646973, + 0.7310585975646973, + 0.7310585975646973, + 0.7310585975646973, + 0.7310585975646973, + 0.7310585975646973, + 0.7310585975646973, + 0.7310585975646973, + 0.7310585975646973, + 0.7310585975646973, + 0.7310585975646973, + 0.7310585975646973, + 0.7310585975646973, + 0.7310585975646973, + 0.7310585975646973, + 0.7310585975646973, + 0.7310585975646973, + 0.7310585975646973, + 0.7310585975646973, + 0.7310585975646973, + 0.7310585975646973, + 0.7310585975646973, + 0.7310585975646973, + 0.7310585975646973, + 0.7310585975646973, + 0.7310585975646973, + 0.7310585975646973, + 0.7310585975646973, + 0.7310585975646973, + 0.7310585975646973, + 0.7310585975646973, + 0.7310585975646973, + 0.7310585975646973, + 0.7310585975646973, + 0.7310585975646973, + 0.7310585975646973, + 0.7310585975646973, + 0.7310585975646973, + 0.7310585975646973, + 0.7310585975646973, + 0.7310585975646973, + 0.7310585975646973, + 0.7310585975646973, + 0.7310585975646973, + 0.7310585975646973, + 0.7310585975646973, + 0.7310585975646973, + 0.7310585975646973, + 0.7310585975646973, + 0.7310585975646973, + 0.7310585975646973, + 0.7310585975646973, + 0.7310585975646973, + 0.7310585975646973, + 0.7310585975646973, + 0.7310585975646973, + 0.7310585975646973, + 0.7310585975646973, + 0.7310585975646973, + 0.7310585975646973, + 0.7310585975646973, + 0.7310585975646973, + 0.7310585975646973, + 0.7310585975646973, + 0.7310585975646973, + 0.7310585975646973, + 0.7310585975646973, + 0.7310585975646973, + 0.7310585975646973, + 0.7310585975646973, + 0.7310585975646973, + 0.7310585975646973, + 0.7310585975646973, + 0.7310585975646973, + 0.7310585975646973, + 0.7310585975646973, + 0.7310585975646973, + 0.7310585975646973, + 0.7310585975646973, + 0.7310585975646973, + 0.7310585975646973, + 0.7310585975646973, + 0.7310585975646973, + 0.7310585975646973, + 0.7310585975646973, + 0.7310585975646973, + 0.7310585975646973, + 0.7310585975646973, + 0.7310585975646973, + 0.7310585975646973, + 0.7310585975646973, + 0.7310585975646973, + 0.7310585975646973, + 0.7310585975646973, + 0.7310585975646973, + 0.7310585975646973, + 0.7310585975646973, + 0.7310585975646973, + 0.7310585975646973, + 0.7310585975646973, + 0.7310585975646973, + 0.7310585975646973, + 0.7310585975646973, + 0.7310585975646973, + 0.7310585975646973, + 0.7310585975646973, + 0.7310585975646973 + ] + ] +} \ No newline at end of file diff --git a/examples/onnx/2l_relu_sigmoid/network.onnx b/examples/onnx/2l_relu_sigmoid/network.onnx new file mode 100644 index 00000000..e5be2bec --- /dev/null +++ b/examples/onnx/2l_relu_sigmoid/network.onnx @@ -0,0 +1,19 @@ +pytorch1.12.1: +& +inputonnx::Sigmoid_5Relu_0"Relu +- +onnx::Sigmoid_5output Sigmoid_1"Sigmoid torch_jitZ) +input + +  +batch_size + + +b* +output + +  +batch_size + + +B diff --git a/examples/onnx/2l_relu_sigmoid_conv/input.json b/examples/onnx/2l_relu_sigmoid_conv/input.json new file mode 100644 index 00000000..471e52ec --- /dev/null +++ b/examples/onnx/2l_relu_sigmoid_conv/input.json @@ -0,0 +1,309 @@ +{ + "input_shapes": [ + [ + 3, + 8, + 8 + ] + ], + "input_data": [ + [ + 0.0078125, + 0.0078125, + 0.0078125, + 0.0078125, + 0.0078125, + 0.0078125, + 0.0078125, + 0.0078125, + 0.0078125, + 0.0078125, + 0.0078125, + 0.0078125, + 0.0078125, + 0.0078125, + 0.0078125, + 0.0078125, + 0.0078125, + 0.0078125, + 0.0078125, + 0.0078125, + 0.0078125, + 0.0078125, + 0.0078125, + 0.0078125, + 0.0078125, + 0.0078125, + 0.0078125, + 0.0078125, + 0.0078125, + 0.0078125, + 0.0078125, + 0.0078125, + 0.0078125, + 0.0078125, + 0.0078125, + 0.0078125, + 0.0078125, + 0.0078125, + 0.0078125, + 0.0078125, + 0.0078125, + 0.0078125, + 0.0078125, + 0.0078125, + 0.0078125, + 0.0078125, + 0.0078125, + 0.0078125, + 0.0078125, + 0.0078125, + 0.0078125, + 0.0078125, + 0.0078125, + 0.0078125, + 0.0078125, + 0.0078125, + 0.0078125, + 0.0078125, + 0.0078125, + 0.0078125, + 0.0078125, + 0.0078125, + 0.0078125, + 0.0078125, + 0.0078125, + 0.0078125, + 0.0078125, + 0.0078125, + 0.0078125, + 0.0078125, + 0.0078125, + 0.0078125, + 0.0078125, + 0.0078125, + 0.0078125, + 0.0078125, + 0.0078125, + 0.0078125, + 0.0078125, + 0.0078125, + 0.0078125, + 0.0078125, + 0.0078125, + 0.0078125, + 0.0078125, + 0.0078125, + 0.0078125, + 0.0078125, + 0.0078125, + 0.0078125, + 0.0078125, + 0.0078125, + 0.0078125, + 0.0078125, + 0.0078125, + 0.0078125, + 0.0078125, + 0.0078125, + 0.0078125, + 0.0078125, + 0.0078125, + 0.0078125, + 0.0078125, + 0.0078125, + 0.0078125, + 0.0078125, + 0.0078125, + 0.0078125, + 0.0078125, + 0.0078125, + 0.0078125, + 0.0078125, + 0.0078125, + 0.0078125, + 0.0078125, + 0.0078125, + 0.0078125, + 0.0078125, + 0.0078125, + 0.0078125, + 0.0078125, + 0.0078125, + 0.0078125, + 0.0078125, + 0.0078125, + 0.0078125, + 0.0078125, + 0.0078125, + 0.0078125, + 0.0078125, + 0.0078125, + 0.0078125, + 0.0078125, + 0.0078125, + 0.0078125, + 0.0078125, + 0.0078125, + 0.0078125, + 0.0078125, + 0.0078125, + 0.0078125, + 0.0078125, + 0.0078125, + 0.0078125, + 0.0078125, + 0.0078125, + 0.0078125, + 0.0078125, + 0.0078125, + 0.0078125, + 0.0078125, + 0.0078125, + 0.0078125, + 0.0078125, + 0.0078125, + 0.0078125, + 0.0078125, + 0.0078125, + 0.0078125, + 0.0078125, + 0.0078125, + 0.0078125, + 0.0078125, + 0.0078125, + 0.0078125, + 0.0078125, + 0.0078125, + 0.0078125, + 0.0078125, + 0.0078125, + 0.0078125, + 0.0078125, + 0.0078125, + 0.0078125, + 0.0078125, + 0.0078125, + 0.0078125, + 0.0078125, + 0.0078125, + 0.0078125, + 0.0078125, + 0.0078125, + 0.0078125, + 0.0078125, + 0.0078125, + 0.0078125, + 0.0078125, + 0.0078125, + 0.0078125, + 0.0078125, + 0.0078125, + 0.0078125 + ] + ], + "output_data": [ + [ + 0.5, + 0.5, + 0.5, + 0.5, + 0.5, + 0.5, + 0.5, + 0.5, + 0.5, + 0.5, + 0.5, + 0.5, + 0.5, + 0.5, + 0.5, + 0.5, + 0.5, + 0.5, + 0.5, + 0.5, + 0.5, + 0.5, + 0.5, + 0.5, + 0.5, + 0.5, + 0.5, + 0.5, + 0.5, + 0.5, + 0.5, + 0.5, + 0.5, + 0.5, + 0.5, + 0.5, + 0.5, + 0.5, + 0.5, + 0.5, + 0.5, + 0.5, + 0.5, + 0.5, + 0.5, + 0.5, + 0.5, + 0.5, + 0.5, + 0.5, + 0.5, + 0.5, + 0.5, + 0.5, + 0.5, + 0.5, + 0.5, + 0.5, + 0.5, + 0.5, + 0.5, + 0.5, + 0.5, + 0.5, + 0.5, + 0.5, + 0.5, + 0.5, + 0.5, + 0.5, + 0.5, + 0.5, + 0.5, + 0.5, + 0.5, + 0.5, + 0.5, + 0.5, + 0.5, + 0.5, + 0.5, + 0.5, + 0.5, + 0.5, + 0.5, + 0.5, + 0.5, + 0.5, + 0.5, + 0.5, + 0.5, + 0.5, + 0.5, + 0.5, + 0.5, + 0.5, + 0.5, + 0.5, + 0.5, + 0.5 + ] + ] +} \ No newline at end of file diff --git a/examples/onnx/2l_relu_sigmoid_conv/network.onnx b/examples/onnx/2l_relu_sigmoid_conv/network.onnx new file mode 100644 index 00000000..5d341204 Binary files /dev/null and b/examples/onnx/2l_relu_sigmoid_conv/network.onnx differ diff --git a/examples/onnx/2l_relu_sigmoid_small/input.json b/examples/onnx/2l_relu_sigmoid_small/input.json new file mode 100644 index 00000000..56aab3e2 --- /dev/null +++ b/examples/onnx/2l_relu_sigmoid_small/input.json @@ -0,0 +1,21 @@ +{ + "input_shapes": [ + [ + 3 + ] + ], + "input_data": [ + [ + -0.3827013373374939, + 1.3510069847106934, + -0.08920183777809143 + ] + ], + "output_data": [ + [ + 0.5, + 0.7942942380905151, + 0.5 + ] + ] +} \ No newline at end of file diff --git a/examples/onnx/2l_relu_sigmoid_small/network.onnx b/examples/onnx/2l_relu_sigmoid_small/network.onnx new file mode 100644 index 00000000..7422513f --- /dev/null +++ b/examples/onnx/2l_relu_sigmoid_small/network.onnx @@ -0,0 +1,15 @@ +pytorch1.12.1: +& +inputonnx::Sigmoid_3Relu_0"Relu +- +onnx::Sigmoid_3output Sigmoid_1"Sigmoid torch_jitZ! +input + +  +batch_size +b" +output + +  +batch_size +B diff --git a/examples/onnx/2l_relu_small/input.json b/examples/onnx/2l_relu_small/input.json new file mode 100644 index 00000000..1d3f2777 --- /dev/null +++ b/examples/onnx/2l_relu_small/input.json @@ -0,0 +1,21 @@ +{ + "input_shapes": [ + [ + 3 + ] + ], + "input_data": [ + [ + 3.394426107406616, + 1.1624923944473267, + -0.5661267638206482 + ] + ], + "output_data": [ + [ + 3.394426107406616, + 1.1624923944473267, + 0.0 + ] + ] +} \ No newline at end of file diff --git a/examples/onnx/2l_relu_small/network.onnx b/examples/onnx/2l_relu_small/network.onnx new file mode 100644 index 00000000..16bfcd2b --- /dev/null +++ b/examples/onnx/2l_relu_small/network.onnx @@ -0,0 +1,15 @@ +pytorch1.12.1: + +inputinput.1Relu_0"Relu + +input.1outputRelu_1"Relu torch_jitZ! +input + +  +batch_size +b" +output + +  +batch_size +B diff --git a/examples/onnx/2l_sigmoid_conv/network.onnx b/examples/onnx/2l_sigmoid_conv/network.onnx new file mode 100644 index 00000000..332f0bc1 Binary files /dev/null and b/examples/onnx/2l_sigmoid_conv/network.onnx differ diff --git a/examples/onnx/3l_linear_mlp/network.onnx b/examples/onnx/3l_linear_mlp/network.onnx new file mode 100644 index 00000000..0e156d41 Binary files /dev/null and b/examples/onnx/3l_linear_mlp/network.onnx differ diff --git a/examples/onnx/large_op_graph/input.json b/examples/onnx/large_op_graph/input.json new file mode 100644 index 00000000..a77e6131 --- /dev/null +++ b/examples/onnx/large_op_graph/input.json @@ -0,0 +1,104 @@ +{ + "input_shapes": [ + [ + 3, + 2, + 2 + ] + ], + "input_data": [ + [ + 1.0463101863861084, + 1.5299336910247803, + 1.9941356182098389, + 1.513040542602539, + 1.4219237565994263, + 0.24078583717346191, + 0.050214409828186035, + 0.4934835433959961, + 0.8263685703277588, + 0.5834146738052368, + 0.8935405015945435, + 1.5646353960037231 + ] + ], + "output_data": [ + [ + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 1.125, + 0.0, + 0.0, + 0.0, + 1.125, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.125, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.625, + 0.25, + 0.375, + 0.0, + 0.0, + 1.0, + 1.625, + 1.0, + 0.0, + 0.0, + 0.0, + 0.25, + 0.5, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.5, + 0.75, + 0.0, + 0.0, + 0.0, + 0.0, + 1.125, + 0.125, + 0.0, + 0.0, + 0.875, + 0.25, + 0.125, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0 + ] + ] +} \ No newline at end of file diff --git a/examples/onnx/large_op_graph/network.onnx b/examples/onnx/large_op_graph/network.onnx new file mode 100644 index 00000000..2a63fc82 Binary files /dev/null and b/examples/onnx/large_op_graph/network.onnx differ diff --git a/examples/onnx/mnist_net/network.onnx b/examples/onnx/mnist_net/network.onnx new file mode 100644 index 00000000..6661bfe3 Binary files /dev/null and b/examples/onnx/mnist_net/network.onnx differ diff --git a/tests/integration_tests.rs b/tests/integration_tests.rs index c487b354..f9332f80 100644 --- a/tests/integration_tests.rs +++ b/tests/integration_tests.rs @@ -220,9 +220,9 @@ fn neg_mock(example_name: String, counter_example: String) { "-K=17", "mock", "-D", - format!("./examples/onnx/examples/{}/input.json", counter_example).as_str(), + format!("./examples/onnx/{}/input.json", counter_example).as_str(), "-M", - format!("./examples/onnx/examples/{}/network.onnx", example_name).as_str(), + format!("./examples/onnx/{}/network.onnx", example_name).as_str(), // "-K", // "2", //causes failure ]) @@ -248,9 +248,9 @@ fn mock(example_name: String) { "-K=17", "mock", "-D", - format!("./examples/onnx/examples/{}/input.json", example_name).as_str(), + format!("./examples/onnx/{}/input.json", example_name).as_str(), "-M", - format!("./examples/onnx/examples/{}/network.onnx", example_name).as_str(), + format!("./examples/onnx/{}/network.onnx", example_name).as_str(), // "-K", // "2", //causes failure ]) @@ -268,9 +268,9 @@ fn mock_public_inputs(example_name: String) { "-K=17", "mock", "-D", - format!("./examples/onnx/examples/{}/input.json", example_name).as_str(), + format!("./examples/onnx/{}/input.json", example_name).as_str(), "-M", - format!("./examples/onnx/examples/{}/network.onnx", example_name).as_str(), + format!("./examples/onnx/{}/network.onnx", example_name).as_str(), // "-K", // "2", //causes failure ]) @@ -288,9 +288,9 @@ fn mock_public_params(example_name: String) { "-K=17", "mock", "-D", - format!("./examples/onnx/examples/{}/input.json", example_name).as_str(), + format!("./examples/onnx/{}/input.json", example_name).as_str(), "-M", - format!("./examples/onnx/examples/{}/network.onnx", example_name).as_str(), + format!("./examples/onnx/{}/network.onnx", example_name).as_str(), // "-K", // "2", //causes failure ]) @@ -308,9 +308,9 @@ fn kzg_aggr_prove_and_verify(example_name: String) { "prove", "--pfsys=kzg", "-D", - format!("./examples/onnx/examples/{}/input.json", example_name).as_str(), + format!("./examples/onnx/{}/input.json", example_name).as_str(), "-M", - format!("./examples/onnx/examples/{}/network.onnx", example_name).as_str(), + format!("./examples/onnx/{}/network.onnx", example_name).as_str(), "--proof-path", format!("kzg_{}.pf", example_name).as_str(), "--vk-path", @@ -329,7 +329,7 @@ fn kzg_aggr_prove_and_verify(example_name: String) { "aggregate", "--pfsys=kzg", "-M", - format!("./examples/onnx/examples/{}/network.onnx", example_name).as_str(), + format!("./examples/onnx/{}/network.onnx", example_name).as_str(), "--aggregation-snarks", format!("kzg_{}.pf", example_name).as_str(), "--aggregation-vk-paths", @@ -371,9 +371,9 @@ fn kzg_evm_aggr_prove_and_verify(example_name: String) { "prove", "--pfsys=kzg", "-D", - format!("./examples/onnx/examples/{}/input.json", example_name).as_str(), + format!("./examples/onnx/{}/input.json", example_name).as_str(), "-M", - format!("./examples/onnx/examples/{}/network.onnx", example_name).as_str(), + format!("./examples/onnx/{}/network.onnx", example_name).as_str(), "--proof-path", format!("kzg_{}.pf", example_name).as_str(), "--vk-path", @@ -392,7 +392,7 @@ fn kzg_evm_aggr_prove_and_verify(example_name: String) { "aggregate", "--pfsys=kzg", "-M", - format!("./examples/onnx/examples/{}/network.onnx", example_name).as_str(), + format!("./examples/onnx/{}/network.onnx", example_name).as_str(), "--aggregation-snarks", format!("kzg_{}.pf", example_name).as_str(), "--aggregation-vk-paths", @@ -447,9 +447,9 @@ fn kzg_prove_and_verify(example_name: String) { "prove", "--pfsys=kzg", "-D", - format!("./examples/onnx/examples/{}/input.json", example_name).as_str(), + format!("./examples/onnx/{}/input.json", example_name).as_str(), "-M", - format!("./examples/onnx/examples/{}/network.onnx", example_name).as_str(), + format!("./examples/onnx/{}/network.onnx", example_name).as_str(), "--proof-path", format!("kzg_{}.pf", example_name).as_str(), "--vk-path", @@ -468,7 +468,7 @@ fn kzg_prove_and_verify(example_name: String) { "verify", "--pfsys=kzg", "-M", - format!("./examples/onnx/examples/{}/network.onnx", example_name).as_str(), + format!("./examples/onnx/{}/network.onnx", example_name).as_str(), "--proof-path", format!("kzg_{}.pf", example_name).as_str(), "--vk-path", @@ -490,9 +490,9 @@ fn kzg_evm_prove_and_verify(example_name: String, with_solidity: bool) { "prove", "--pfsys=kzg", "-D", - format!("./examples/onnx/examples/{}/input.json", example_name).as_str(), + format!("./examples/onnx/{}/input.json", example_name).as_str(), "-M", - format!("./examples/onnx/examples/{}/network.onnx", example_name).as_str(), + format!("./examples/onnx/{}/network.onnx", example_name).as_str(), "--proof-path", format!("kzg_{}.pf", example_name).as_str(), "--vk-path", @@ -505,8 +505,8 @@ fn kzg_evm_prove_and_verify(example_name: String, with_solidity: bool) { .expect("failed to execute process"); assert!(status.success()); - let input_arg = format!("./examples/onnx/examples/{}/input.json", example_name); - let network_arg = format!("./examples/onnx/examples/{}/network.onnx", example_name); + let input_arg = format!("./examples/onnx/{}/input.json", example_name); + let network_arg = format!("./examples/onnx/{}/network.onnx", example_name); let code_arg = format!("kzg_{}.code", example_name); let vk_arg = format!("kzg_{}.vk", example_name);