Skip to content

Commit

Permalink
Chore/update docs (#67)
Browse files Browse the repository at this point in the history
* chore: update anvil install instructions

* chore: remove settings.json where it is deprecated

* chore: update aggregagtion docs

* chore: lint

* remove more settings, get-srs

---------

Co-authored-by: jason <[email protected]>
  • Loading branch information
distributedstatemachine and jasonmorton authored Oct 6, 2023
1 parent 909fe6f commit 953a443
Show file tree
Hide file tree
Showing 9 changed files with 136 additions and 92 deletions.
4 changes: 2 additions & 2 deletions About_EZKL/Commands.md
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ Along with our SRS and circuit parameters, we need two other elements to generat
Run this command to set up your proving and verifying keys:

```bash
ezkl setup -M network.ezkl --srs-path=17.srs --settings-path=settings.json
ezkl setup -M network.ezkl --srs-path=17.srs
```
You should now have files called `vk.key` and `pk.key` in the root of your project. You can also specify different paths for these outputs with `--vk-path=altvk.key --pk-path=altpk.key`

Expand Down Expand Up @@ -130,7 +130,7 @@ Note that these are not the only operations that can be performed by `ezkl`. You
When you're testing a model, you may not want to run `setup` and `prove` with each iteration. `ezkl` provides a simple alternative with `mock`, where you can convert your model to constraints and run the inputs tosee if a proof can be generated. This saves time when testing new iterations of models with potential issues. Here is the command for `mock`:

```bash
ezkl mock -M network.ezkl --witness witness.json --settings-path=settings.json
ezkl mock -M network.ezkl --witness witness.json
```

Mock is basically checking that constraints that your model has been translated into are satisfied, without doing any of the subsequent cryptographic heavy lifting to produce a proof.
Expand Down
72 changes: 52 additions & 20 deletions FAQ.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,78 +2,110 @@
icon: question
order: -99999999
---
![](../assets/copter.png)
![](../assets/copter.png)

# FAQ

### What programming languages and frameworks does ezkl support?
`ezkl` is a command line tool, and a library that can be used from Rust or Python. You may want to use Python to create a neural network and export it. Though ezkl is built with Rust, you do not need to use Rust except possibly for installation.

`ezkl` is a command line tool, and a library that can be used from Rust or Python. You may want to use Python to create a neural network and export it. Though ezkl is built with Rust, you do not need to use Rust except possibly for installation.

### Do I need to know Rust before getting started with ezkl?
No, Rust is not a requirement to use the library. As long as you have the ONNX file and proper input & output format of the model, you can use `ezkl`.

No, Rust is not a requirement to use the library. As long as you have the ONNX file and proper input & output format of the model, you can use `ezkl`.

# Technical

### Why is the gen-srs step slow?

Generating a structured reference string takes a considerable amount of time and memory. Make sure your machine has enough memory available and wait for the process to finish. Alternatively, download a pre-generated srs.

### Can I use ezkl with other machine learning frameworks like TensorFlow, PyTorch, or Scikit-learn?

All `ezkl` requires is an onnx file and a JSON configuration of mock inputs and outputs of the neural network. At this time, it works best with PyTorch.

### How fast is ezkl?

We believe that `ezkl` is the fastest zkml package available, and we are working hard every day to make it faster. Feel free to run `cargo bench` on your machine to see what the benchmarks are for your hardware.

### Do I need to deploy a verifier smart contract to use ezkl?

No, we recently integrated a [WASM verifier](https://github.com/zkonduit/ezkl/pull/219) that you can use to verify proofs from your web application. You can also use the EVM verifier to verify proofs locally, or the command line `ezkl verify` command.

# Errors:
# Errors

### Error: VerifyError
A VerifyError is thrown when the Mock prover fails, often due to a mismatched shape problem in the model. Please verify that your input.json inputs and outputs match those of your .onnx file.

A VerifyError is thrown when the Mock prover fails, often due to a mismatched shape problem in the model. Please verify that your input.json inputs and outputs match those of your .onnx file.

### Error: DimMismatch
A DimMismatch error is thrown when there is a mismatch in the lengths of the tensor operands during circuit construction.

A DimMismatch error is thrown when there is a mismatch in the lengths of the tensor operands during circuit construction.

### Error: LookupInstantiation

This error is thrown when there is an error during the creation of a lookup table

### Error: TableAlreadyAssigned

A TableAlreadyAssigned Error is thrown when `ezkl` attempts to initialize a lookup table that has already been initialized

### Error: UnsupportedOp

An UnsupportedOp Error is thrown when there is an operation in the ONNX file that `ezkl` cannot yet handle. Please look at the supported operations under src/circuit/ops to get an idea of what operations `ezkl` can handle.

### Error: PyValueError

This is a pyo3 error that occurs when a data type fails to be extracted from Python to Rust. Please make sure you are passing the correct data types when utilizing the python bindings.

### Error: InvalidLookupInputs
InvalidLookupInputs is thrown when the wrong inputs were passed to a lookup node.

InvalidLookupInputs is thrown when the wrong inputs were passed to a lookup node.

### Error: InvalidDims

InvalidDims is thrown when there is a shape mismatch in circuit construction. Invalid dimensions were used for a node with the given index and description.

### Error: WrongMethod

This error means that the wrong method was called to configure a node with the given index and description

### Error: MissingNode

MissingNode is thrown when a requested node is missing in the graph with the given index

### Error: OpMismatch

OpMismatch is thrown when an unsupported method was called on a node with the given index and description

### Error: UnsupportedOp

UnsupportedOp is thrown when there is an operation in the onnx graph that isn't supported by `ezkl`

### Error: MissingParams
MissingParams is thrown when a node has missing parameters; please check the parameters in your model's operations
### Error: MisformedParams
MisformedParams is thrown when a node has misformed parameters; the error can stem from erroneous padding height and width dimensions, wrong kernel / data format, dilations that are not uint type, and more.
### Error: Visibility
This error is typically thrown when no public variables are passed to the circuit configuration function
### Error: NonConstantDiv
`ezkl` only supports divisions by constants
### Error: NonConstantPower
`ezkl` only supports constant exponents
### Error: RescalingError
This error is thrown when attempting to rescale inputs for an operation
### Error: ModelLoad
This error is thrown when a model fails to load; please check your onnx file for missing connections / unsupported layers. We suggest using [Netron](https://netron.app/) to view onnx files.

MissingParams is thrown when a node has missing parameters; please check the parameters in your model's operations

### Error: MisformedParams

MisformedParams is thrown when a node has misformed parameters; the error can stem from erroneous padding height and width dimensions, wrong kernel / data format, dilations that are not uint type, and more.

### Error: Visibility

This error is typically thrown when no public variables are passed to the circuit configuration function

### Error: NonConstantDiv

`ezkl` only supports divisions by constants

### Error: NonConstantPower

`ezkl` only supports constant exponents

### Error: RescalingError

This error is thrown when attempting to rescale inputs for an operation

### Error: ModelLoad

This error is thrown when a model fails to load; please check your onnx file for missing connections / unsupported layers. We suggest using [Netron](https://netron.app/) to view onnx files.
11 changes: 9 additions & 2 deletions Getting_Started.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,30 +4,37 @@ order: 95
---

### Installing EZKL

To use `ezkl` in Python, just `pip install ezkl`. You will generally also need `onnx` installed if you are exporting models, and Pytorch, Tensorflow, or similar if you are creating models.

`ezkl` uses your system `solc` Solidity compiler, so you may need to tweak it using svm-rs or solc-select, particularly if you are targeting a specific hardfork.

To use the cli, download a [release binary](https://github.com/zkonduit/ezkl/releases) from GitHub. If you want the latest build, you can also install from source.

To use the cli, download a [release binary](https://github.com/zkonduit/ezkl/releases) from GitHub. If you want the latest build, you can also install from source.

### Building from source 🔨

Ezkl is built in rust. First [install rust](https://www.rust-lang.org/tools/install), then download the repo and enter the directory

```bash
git clone [email protected]:zkonduit/ezkl.git
cd ezkl
```

After which you may build and install the library

```bash
cargo install --force --path .
```

If you want to build manually with cargo build, be sure to use the release flag as the debug build will result in slow proofs

```bash
cargo build --release --bin ezkl
```

> Note: To render your model circuits, you'll need to compile `ezkl` with the `render` feature (`cargo build --features render --bin ezkl`). This enables the `render-circuit` command which can create `.png` representations of the compiled circuits. You'll also need to install the `libexpat1-dev` and `libfreetype6-dev` libraries on Debian systems (there are equivalents for MacOS as well).
---------

##### Rust docs 📖

Use `cargo doc --open` to compile and open the Rust documentation for `ezkl` in your default browser.
Loading

0 comments on commit 953a443

Please sign in to comment.