file_path
stringlengths
7
180
content
stringlengths
0
811k
repo
stringclasses
11 values
awesome-orion/finance/provable_multiple_linear_regression_solver/src/datasets/linear_data/feature_data.cairo
use array::ArrayTrait; use orion::numbers::fixed_point::implementations::fp16x16::core::{FP16x16Impl, FP16x16PartialEq}; use orion::operators::tensor::{Tensor, TensorTrait, FP16x16Tensor}; use orion::numbers::{FP16x16, FixedTrait}; fn x_feature_data() -> Tensor<FP16x16> { let tensor = TensorTrait::< FP16x1...
https://github.com/gizatechxyz/Giza-Hub
awesome-orion/finance/provable_multiple_linear_regression_solver/src/datasets/linear_data/label_data.cairo
use array::ArrayTrait; use orion::numbers::fixed_point::implementations::fp16x16::core::{FP16x16Impl, FP16x16PartialEq}; use orion::operators::tensor::{Tensor, TensorTrait, FP16x16Tensor}; use orion::numbers::{FP16x16, FixedTrait}; fn y_label_data() -> Tensor<FP16x16> { let tensor = TensorTrait::< FP16x16 ...
https://github.com/gizatechxyz/Giza-Hub
awesome-orion/finance/provable_multiple_linear_regression_solver/src/datasets/user_inputs_data.cairo
mod user_inputs_boston_data; mod aave_weth_revenue_data_input;
https://github.com/gizatechxyz/Giza-Hub
awesome-orion/finance/provable_multiple_linear_regression_solver/src/datasets/user_inputs_data/aave_weth_revenue_data_input.cairo
use array::ArrayTrait; use orion::numbers::fixed_point::implementations::fp16x16::core::{FP16x16Impl, FP16x16PartialEq}; use orion::operators::tensor::{Tensor, TensorTrait, FP16x16Tensor}; use orion::numbers::{FP16x16, FixedTrait}; fn aave_weth_revenue_data_input() -> Tensor<FP16x16> { let tensor = TensorTrait::< ...
https://github.com/gizatechxyz/Giza-Hub
awesome-orion/finance/provable_multiple_linear_regression_solver/src/datasets/user_inputs_data/user_inputs_boston_data.cairo
use array::ArrayTrait; use orion::numbers::fixed_point::implementations::fp16x16::core::{FP16x16Impl, FP16x16PartialEq}; use orion::operators::tensor::{Tensor, TensorTrait, FP16x16Tensor}; use orion::numbers::{FP16x16, FixedTrait}; fn user_input_boston_housing() -> Tensor<FP16x16> { let tensor = TensorTrait::< ...
https://github.com/gizatechxyz/Giza-Hub
awesome-orion/finance/provable_multiple_linear_regression_solver/src/helper_functions.cairo
use debug::PrintTrait; use array::{ArrayTrait, SpanTrait}; use orion::operators::tensor::{ Tensor, TensorTrait, FP16x16Tensor, U32Tensor, U32TensorAdd, FP16x16TensorSub, FP16x16TensorAdd, FP16x16TensorDiv, FP16x16TensorMul }; use orion::numbers::{FP16x16, FixedTrait}; // retrieves row data by index in a 2D te...
https://github.com/gizatechxyz/Giza-Hub
awesome-orion/finance/provable_multiple_linear_regression_solver/src/lib.cairo
mod test; mod data_preprocessing; mod helper_functions; mod datasets; mod model;
https://github.com/gizatechxyz/Giza-Hub
awesome-orion/finance/provable_multiple_linear_regression_solver/src/model.cairo
mod linear_regression_model; mod multiple_linear_regression_model;
https://github.com/gizatechxyz/Giza-Hub
awesome-orion/finance/provable_multiple_linear_regression_solver/src/model/linear_regression_model.cairo
use orion::operators::tensor::{ Tensor, TensorTrait, FP16x16Tensor, U32Tensor, U32TensorAdd, FP16x16TensorSub, FP16x16TensorAdd, FP16x16TensorDiv, FP16x16TensorMul }; use orion::numbers::{FP16x16, FixedTrait}; use multiple_linear_regresion::data_preprocessing::{Dataset, DatasetTrait}; use multiple_linear_regres...
https://github.com/gizatechxyz/Giza-Hub
awesome-orion/finance/provable_multiple_linear_regression_solver/src/model/multiple_linear_regression_model.cairo
use orion::operators::tensor::{ Tensor, TensorTrait, FP16x16Tensor, U32Tensor, U32TensorAdd, FP16x16TensorSub, FP16x16TensorAdd, FP16x16TensorDiv, FP16x16TensorMul }; use orion::numbers::{FP16x16, FixedTrait}; use multiple_linear_regresion::data_preprocessing::{Dataset, DatasetTrait}; use multiple_linear_regres...
https://github.com/gizatechxyz/Giza-Hub
awesome-orion/finance/provable_multiple_linear_regression_solver/src/test.cairo
// use traits::Into; use debug::PrintTrait; use array::{ArrayTrait, SpanTrait}; use multiple_linear_regresion::datasets::aave_data::aave_x_features::aave_x_features; use multiple_linear_regresion::datasets::aave_data::aave_y_labels::aave_y_labels; use multiple_linear_regresion::datasets::boston_data::boston_x_features...
https://github.com/gizatechxyz/Giza-Hub
awesome-orion/gaming/tic_tac_toe/tic_tac_toe.ipynb
{ "cells": [ { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "# Importing required moduless\n", "import numpy as np \n", "import pandas as pd \n", "import pprint,random\n", "\n", "from scipy.ndimage.interpolation import shift\n", "...
https://github.com/gizatechxyz/Giza-Hub
awesome-orion/gaming/tic_tac_toe/tic_tac_toe_orion/crates/sequential_1_dense_1_biasadd_readvariableop_0/src/lib.cairo
use array::{ArrayTrait, SpanTrait}; use orion::operators::tensor::{TensorTrait, Tensor}; use orion::operators::tensor::FP16x16Tensor; use orion::numbers::{FixedTrait, FP16x16}; fn tensor() -> Tensor<FP16x16> { Tensor { shape: array![18,].span(), data: array![ FP16x16 { mag: 77099, sign:...
https://github.com/gizatechxyz/Giza-Hub
awesome-orion/gaming/tic_tac_toe/tic_tac_toe_orion/crates/sequential_1_dense_1_matmul_readvariableop_0/src/lib.cairo
use array::{ArrayTrait, SpanTrait}; use orion::operators::tensor::{TensorTrait, Tensor}; use orion::operators::tensor::FP16x16Tensor; use orion::numbers::{FixedTrait, FP16x16}; fn tensor() -> Tensor<FP16x16> { Tensor { shape: array![9, 18,].span(), data: array![ FP16x16 { mag: 3955, sig...
https://github.com/gizatechxyz/Giza-Hub
awesome-orion/gaming/tic_tac_toe/tic_tac_toe_orion/crates/sequential_1_dense_2_biasadd_readvariableop_0/src/lib.cairo
use array::{ArrayTrait, SpanTrait}; use orion::operators::tensor::{TensorTrait, Tensor}; use orion::operators::tensor::FP16x16Tensor; use orion::numbers::{FixedTrait, FP16x16}; fn tensor() -> Tensor<FP16x16> { Tensor { shape: array![9,].span(), data: array![ FP16x16 {mag: 1241, sign: true}, FP16x16 {...
https://github.com/gizatechxyz/Giza-Hub
awesome-orion/gaming/tic_tac_toe/tic_tac_toe_orion/crates/sequential_1_dense_2_matmul_readvariableop_0/src/lib.cairo
use array::{ArrayTrait, SpanTrait}; use orion::operators::tensor::{TensorTrait, Tensor}; use orion::operators::tensor::FP16x16Tensor; use orion::numbers::{FixedTrait, FP16x16}; fn tensor() -> Tensor<FP16x16> { Tensor { shape: array![18,9,].span(), data: array![ FP16x16 {mag: 2465, sign: false}, FP16x...
https://github.com/gizatechxyz/Giza-Hub
awesome-orion/gaming/tic_tac_toe/tic_tac_toe_orion/crates/sequential_1_dense_3_biasadd_readvariableop_0/src/lib.cairo
use array::{ArrayTrait, SpanTrait}; use orion::operators::tensor::{TensorTrait, Tensor}; use orion::operators::tensor::FP16x16Tensor; use orion::numbers::{FixedTrait, FP16x16}; fn tensor() -> Tensor<FP16x16> { Tensor { shape: array![1,].span(), data: array![ FP16x16 {mag: 17046, sign: false}, ].span(...
https://github.com/gizatechxyz/Giza-Hub
awesome-orion/gaming/tic_tac_toe/tic_tac_toe_orion/crates/sequential_1_dense_3_matmul_readvariableop_0/src/lib.cairo
use array::{ArrayTrait, SpanTrait}; use orion::operators::tensor::{TensorTrait, Tensor}; use orion::operators::tensor::FP16x16Tensor; use orion::numbers::{FixedTrait, FP16x16}; fn tensor() -> Tensor<FP16x16> { Tensor { shape: array![9,1,].span(), data: array![ FP16x16 {mag: 15010, sign: true}, FP16x1...
https://github.com/gizatechxyz/Giza-Hub
awesome-orion/gaming/tic_tac_toe/tic_tac_toe_orion/src/inference.cairo
#[starknet::contract] mod OrionRunner { use core::array::SpanTrait; use orion::operators::tensor::{TensorTrait, FP16x16Tensor, Tensor, FP16x16TensorAdd}; use orion::operators::nn::{NNTrait, FP16x16NN}; use orion::numbers::{FP16x16, FixedTrait}; use sequential_1_dense_1_matmul_readvariableop_0::tens...
https://github.com/gizatechxyz/Giza-Hub
awesome-orion/gaming/tic_tac_toe/tic_tac_toe_orion/src/lib.cairo
mod inference; mod test;
https://github.com/gizatechxyz/Giza-Hub
awesome-orion/gaming/tic_tac_toe/tic_tac_toe_orion/src/test.cairo
#[cfg(test)] mod tests { use core::array::SpanTrait; use orion::operators::tensor::{TensorTrait, FP16x16Tensor, Tensor, FP16x16TensorAdd}; use orion::operators::nn::{NNTrait, FP16x16NN}; use orion::numbers::{FP16x16, FixedTrait}; use sequential_1_dense_1_matmul_readvariableop_0::tensor as _sequenti...
https://github.com/gizatechxyz/Giza-Hub
benches/accum_conv.rs
use criterion::{criterion_group, criterion_main, BenchmarkId, Criterion, Throughput}; use ezkl::circuit::poly::PolyOp; use ezkl::circuit::*; use ezkl::pfsys::create_keys; use ezkl::pfsys::create_proof_circuit; use ezkl::pfsys::srs::gen_srs; use ezkl::pfsys::TranscriptType; use ezkl::tensor::*; use halo2_proofs::poly::k...
https://github.com/zkonduit/ezkl
benches/accum_dot.rs
use criterion::{criterion_group, criterion_main, BenchmarkId, Criterion, Throughput}; use ezkl::circuit::poly::PolyOp; use ezkl::circuit::*; use ezkl::pfsys::create_proof_circuit; use ezkl::pfsys::TranscriptType; use ezkl::pfsys::{create_keys, srs::gen_srs}; use ezkl::tensor::*; use halo2_proofs::poly::kzg::commitment:...
https://github.com/zkonduit/ezkl
benches/accum_einsum_matmul.rs
use criterion::{criterion_group, criterion_main, BenchmarkId, Criterion, Throughput}; use ezkl::circuit::poly::PolyOp; use ezkl::circuit::*; use ezkl::pfsys::create_proof_circuit; use ezkl::pfsys::TranscriptType; use ezkl::pfsys::{create_keys, srs::gen_srs}; use ezkl::tensor::*; use halo2_proofs::poly::kzg::commitment:...
https://github.com/zkonduit/ezkl
benches/accum_matmul_relu.rs
use criterion::{criterion_group, criterion_main, BenchmarkId, Criterion, Throughput}; use ezkl::circuit::table::Range; use ezkl::circuit::*; use ezkl::circuit::lookup::LookupOp; use ezkl::circuit::poly::PolyOp; use ezkl::pfsys::create_proof_circuit; use ezkl::pfsys::TranscriptType; use ezkl::pfsys::{create_keys, srs::...
https://github.com/zkonduit/ezkl
benches/accum_matmul_relu_overflow.rs
use criterion::{criterion_group, criterion_main, BenchmarkId, Criterion, Throughput}; use ezkl::circuit::*; use ezkl::circuit::lookup::LookupOp; use ezkl::circuit::poly::PolyOp; use ezkl::circuit::table::Range; use ezkl::pfsys::create_proof_circuit; use ezkl::pfsys::TranscriptType; use ezkl::pfsys::{create_keys, srs::...
https://github.com/zkonduit/ezkl
benches/accum_sum.rs
use criterion::{criterion_group, criterion_main, BenchmarkId, Criterion, Throughput}; use ezkl::circuit::poly::PolyOp; use ezkl::circuit::*; use ezkl::pfsys::create_proof_circuit; use ezkl::pfsys::TranscriptType; use ezkl::pfsys::{create_keys, srs::gen_srs}; use ezkl::tensor::*; use halo2_proofs::poly::kzg::commitment:...
https://github.com/zkonduit/ezkl
benches/accum_sumpool.rs
use criterion::{criterion_group, criterion_main, BenchmarkId, Criterion, Throughput}; use ezkl::circuit::hybrid::HybridOp; use ezkl::circuit::*; use ezkl::pfsys::create_keys; use ezkl::pfsys::create_proof_circuit; use ezkl::pfsys::srs::gen_srs; use ezkl::pfsys::TranscriptType; use ezkl::tensor::*; use halo2_proofs::pol...
https://github.com/zkonduit/ezkl
benches/pairwise_add.rs
use criterion::{criterion_group, criterion_main, BenchmarkId, Criterion, Throughput}; use ezkl::circuit::poly::PolyOp; use ezkl::circuit::*; use ezkl::pfsys::create_proof_circuit; use ezkl::pfsys::TranscriptType; use ezkl::pfsys::{create_keys, srs::gen_srs}; use ezkl::tensor::*; use halo2_proofs::poly::kzg::commitment:...
https://github.com/zkonduit/ezkl
benches/pairwise_pow.rs
use criterion::{criterion_group, criterion_main, BenchmarkId, Criterion, Throughput}; use ezkl::circuit::poly::PolyOp; use ezkl::circuit::region::RegionCtx; use ezkl::circuit::*; use ezkl::pfsys::create_proof_circuit; use ezkl::pfsys::TranscriptType; use ezkl::pfsys::{create_keys, srs::gen_srs}; use ezkl::tensor::*; us...
https://github.com/zkonduit/ezkl
benches/poseidon.rs
use std::collections::HashMap; use criterion::{criterion_group, criterion_main, BenchmarkId, Criterion, Throughput}; use ezkl::circuit::modules::poseidon::spec::{PoseidonSpec, POSEIDON_RATE, POSEIDON_WIDTH}; use ezkl::circuit::modules::poseidon::{PoseidonChip, PoseidonConfig}; use ezkl::circuit::modules::Module; use e...
https://github.com/zkonduit/ezkl
benches/relu.rs
use criterion::{criterion_group, criterion_main, BenchmarkId, Criterion, Throughput}; use ezkl::circuit::region::RegionCtx; use ezkl::circuit::table::Range; use ezkl::circuit::{ops::lookup::LookupOp, BaseConfig as Config, CheckMode}; use ezkl::pfsys::create_proof_circuit; use ezkl::pfsys::TranscriptType; use ezkl::pfsy...
https://github.com/zkonduit/ezkl
contracts/AttestData.sol
// SPDX-License-Identifier: MIT pragma solidity ^0.8.20; import './LoadInstances.sol'; // This contract serves as a Data Attestation Verifier for the EZKL model. // It is designed to read and attest to instances of proofs generated from a specified circuit. // It is particularly constructed to read only int256 data fr...
https://github.com/zkonduit/ezkl
contracts/LoadInstances.sol
// SPDX-License-Identifier: MIT pragma solidity ^0.8.20; contract LoadInstances { /** * @dev Parse the instances array from the Halo2Verifier encoded calldata. * @notice must pass encoded bytes from memory * @param encoded - verifier calldata */ function getInstancesMemory( bytes me...
https://github.com/zkonduit/ezkl
contracts/QuantizeData.sol
// SPDX-License-Identifier: GPL-3.0 pragma solidity ^0.8.17; contract QuantizeData { /** * @notice EZKL P value * @dev In order to prevent the verifier from accepting two version of the same instance, n and the quantity (n + P), where n + P <= 2^256, we require that all instances are stricly less than ...
https://github.com/zkonduit/ezkl
contracts/TestReads.sol
// SPDX-License-Identifier: UNLICENSED pragma solidity ^0.8.17; contract TestReads { int[] public arr; constructor(int256[] memory _numbers) { for (uint256 i = 0; i < _numbers.length; i++) { arr.push(_numbers[i]); } } }
https://github.com/zkonduit/ezkl
docs/python/src/conf.py
import ezkl project = 'ezkl' release = '0.0.0' version = release extensions = [ 'sphinx.ext.autodoc', 'sphinx.ext.autosummary', 'sphinx.ext.intersphinx', 'sphinx.ext.todo', 'sphinx.ext.inheritance_diagram', 'sphinx.ext.autosectionlabel', 'sphinx.ext.napoleon', 'sphinx_rtd_theme', ] a...
https://github.com/zkonduit/ezkl
examples/conv2d_mnist/main.rs
use ezkl::circuit::region::RegionCtx; use ezkl::circuit::{ ops::lookup::LookupOp, ops::poly::PolyOp, BaseConfig as PolyConfig, CheckMode, }; use ezkl::fieldutils; use ezkl::fieldutils::i32_to_felt; use ezkl::tensor::*; use halo2_proofs::dev::MockProver; use halo2_proofs::poly::commitment::Params; use halo2_proofs::...
https://github.com/zkonduit/ezkl
examples/conv2d_mnist/params.rs
pub struct Params { pub kernels: Vec<Vec<Vec<Vec<f32>>>>, pub weights: Vec<Vec<f32>>, pub biases: Vec<f32>, } impl Params { pub fn new() -> Params { let kernels: Vec<Vec<Vec<Vec<f32>>>> = vec![ vec![ vec![vec![ -0.109_487_005, 0...
https://github.com/zkonduit/ezkl
examples/mlp_4d_einsum.rs
use ezkl::circuit::region::RegionCtx; use ezkl::circuit::{ ops::lookup::LookupOp, ops::poly::PolyOp, BaseConfig as PolyConfig, CheckMode, }; use ezkl::fieldutils::i32_to_felt; use ezkl::tensor::*; use halo2_proofs::dev::MockProver; use halo2_proofs::{ circuit::{Layouter, SimpleFloorPlanner, Value}, plonk::{...
https://github.com/zkonduit/ezkl
examples/notebooks/data_attest.ipynb
{ "cells": [ { "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ "# data-attest-ezkl\n", "\n", "Here's an example leveraging EZKL whereby the inputs to the model are read and attested to fro...
https://github.com/zkonduit/ezkl
examples/notebooks/data_attest_hashed.ipynb
{ "cells": [ { "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ "# data-attest-ezkl hashed\n", "\n", "Here's an example leveraging EZKL whereby the hashes of the outputs to the model are re...
https://github.com/zkonduit/ezkl
examples/notebooks/decision_tree.ipynb
{ "cells": [ { "attachments": { "image-2.png": { "image/png": "iVBORw0KGgoAAAANSUhEUgAAAokAAARDCAYAAAAEdLvJAAABYmlDQ1BJQ0MgUHJvZmlsZQAAKJF1kDFLw1AUhU9stSAVHRwEHQKKUy01rdi1LSKCQxoVqlvyWlMlTR9JRNTFQRengi5uUhd/gS4OjoKDguAgIoKDP0DsoiXeNGpbxft43I/DvYfDBTrCKudGEEDJd...
https://github.com/zkonduit/ezkl
examples/notebooks/ezkl_demo.ipynb
{ "cells": [ { "cell_type": "markdown", "metadata": { "id": "n8QlFzjPRIGN" }, "source": [ "# EZKL DEMO\n", "\n", "**Learning Objectives**\n", "1. Learn some basic AI/ML techniques by training a toy model in pytorch to perform classification\n", ...
https://github.com/zkonduit/ezkl
examples/notebooks/gcn.ipynb
{ "cells": [ { "cell_type": "markdown", "id": "5fe9feb6-2b35-414a-be9d-771eabdbb0dc", "metadata": { "id": "5fe9feb6-2b35-414a-be9d-771eabdbb0dc" }, "source": [ "## EZKL GCN Notebook" ] }, { "cell_type": "code", "execution_count": null, ...
https://github.com/zkonduit/ezkl
examples/notebooks/generalized_inverse.ipynb
{ "cells": [ { "cell_type": "markdown", "id": "cf69bb3f-94e6-4dba-92cd-ce08df117d67", "metadata": { "id": "cf69bb3f-94e6-4dba-92cd-ce08df117d67" }, "source": [ "\n", "## Generalized Inverse\n", "\n", "We show how to use EZKL to prove that we kn...
https://github.com/zkonduit/ezkl
examples/notebooks/gradient_boosted_trees.ipynb
{ "cells": [ { "attachments": { "image-2.png": { "image/png": "iVBORw0KGgoAAAANSUhEUgAAAokAAARDCAYAAAAEdLvJAAABYmlDQ1BJQ0MgUHJvZmlsZQAAKJF1kDFLw1AUhU9stSAVHRwEHQKKUy01rdi1LSKCQxoVqlvyWlMlTR9JRNTFQRengi5uUhd/gS4OjoKDguAgIoKDP0DsoiXeNGpbxft43I/DvYfDBTrCKudGEEDJd...
https://github.com/zkonduit/ezkl
examples/notebooks/hashed_vis.ipynb
{ "cells": [ { "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ "# hashed-ezkl\n", "\n", "Here's an example leveraging EZKL whereby the inputs to the model, and the model params themselves,...
https://github.com/zkonduit/ezkl
examples/notebooks/keras_simple_demo.ipynb
{ "cells": [ { "attachments": {}, "cell_type": "markdown", "id": "cf69bb3f-94e6-4dba-92cd-ce08df117d67", "metadata": {}, "source": [ "## EZKL Jupyter Notebook Demo with Keras\n" ] }, { "cell_t...
https://github.com/zkonduit/ezkl
examples/notebooks/kmeans.ipynb
{ "cells": [ { "attachments": {}, "cell_type": "markdown", "id": "cf69bb3f-94e6-4dba-92cd-ce08df117d67", "metadata": {}, "source": [ "## K-means\n", "\n", "\n" ] }, { ...
https://github.com/zkonduit/ezkl
examples/notebooks/kzg_vis.ipynb
{ "cells": [ { "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ "# kzg-ezkl\n", "\n", "Here's an example leveraging EZKL whereby the inputs to the model, and the model params themselves, ar...
https://github.com/zkonduit/ezkl
examples/notebooks/lightgbm.ipynb
{ "cells": [ { "attachments": { "image-3.png": { "image/png": "iVBORw0KGgoAAAANSUhEUgAAAywAAAV+CAYAAACUGLpbAAAMPWlDQ1BJQ0MgUHJvZmlsZQAASImVVwdYU8kWnltSIbQAAlJCb4JIDSAlhBZAercRkgChhBgIKnZ0UcG1iwVs6KqIYqfZETuLYsO+WFBR1sWCXXmTArruK9873zf3/vefM/85c+7cMgCon+CKxbmoB...
https://github.com/zkonduit/ezkl
examples/notebooks/linear_regression.ipynb
{ "cells": [ { "cell_type": "markdown", "id": "cf69bb3f-94e6-4dba-92cd-ce08df117d67", "metadata": {}, "source": [ "## Linear Regression\n", "\n", "\n", "Sklearn based models are slightly finicky t...
https://github.com/zkonduit/ezkl
examples/notebooks/little_transformer.ipynb
{ "cells": [ { "cell_type": "markdown", "id": "d0a82619", "metadata": {}, "source": [ "Credits to [geohot](https://github.com/geohot/ai-notebooks/blob/master/mnist_gan.ipynb) for most of this code\n", "\n", "## M...
https://github.com/zkonduit/ezkl
examples/notebooks/lstm.ipynb
{ "cells": [ { "cell_type": "markdown", "id": "d0a82619", "metadata": {}, "source": [ "\n", "## Model Architecture and training" ] }, { "cell_type": "code", "execution_count": ...
https://github.com/zkonduit/ezkl
examples/notebooks/mean_postgres.ipynb
{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "## Mean of ERC20 transfer amounts\n", "\n", "This notebook shows how to calculate the mean of ERC20 transfer amounts, pulling data in from a Postgres database. First we install and get the necessary libr...
https://github.com/zkonduit/ezkl
examples/notebooks/mnist_classifier.ipynb
{ "cells": [ { "cell_type": "markdown", "metadata": { "id": "6ypZa6jg0rZy" }, "source": [ "## Mnist Clan-ssifier ;)\n", "\n", "Here we demonstrate how to use the EZKL package to build an MNIST classifier for on-chain handrawn digit recognition.\n", "...
https://github.com/zkonduit/ezkl
examples/notebooks/mnist_gan.ipynb
{ "cells": [ { "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ "\n", "Credits to [geohot](https://github.com/geohot/ai-notebooks/blob/master/mnist_gan.ipynb) for most of this code" ] }...
https://github.com/zkonduit/ezkl
examples/notebooks/mnist_gan_proof_splitting.ipynb
{ "cells": [ { "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ "# Proof splitting\n", "\n", "Here we showcase how to split a larger circuit into multiple smaller proofs. This is useful if ...
https://github.com/zkonduit/ezkl
examples/notebooks/mnist_vae.ipynb
{ "cells": [ { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "# what is the variational?" ] }, { "cell_type": "markdown", "metadata": {},...
https://github.com/zkonduit/ezkl
examples/notebooks/nbeats_timeseries_forecasting.ipynb
{ "cells": [ { "cell_type": "markdown", "metadata": { "id": "TB8jFLoLwZ8K" }, "source": [ "# N-BEATS Time Series Forecasting\n", "In this tutorial we utilize the N-BEATS (Neural basis expansion analysis for interpretable time series forecasting\n", ") for fo...
https://github.com/zkonduit/ezkl
examples/notebooks/proof_splitting.ipynb
{ "cells": [ { "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ "# Proof splitting\n", "\n", "Here we showcase how to split a larger circuit into multiple smaller proofs. This is useful if ...
https://github.com/zkonduit/ezkl
examples/notebooks/random_forest.ipynb
{ "cells": [ { "attachments": { "image-2.png": { "image/png": "iVBORw0KGgoAAAANSUhEUgAAAokAAARDCAYAAAAEdLvJAAABYmlDQ1BJQ0MgUHJvZmlsZQAAKJF1kDFLw1AUhU9stSAVHRwEHQKKUy01rdi1LSKCQxoVqlvyWlMlTR9JRNTFQRengi5uUhd/gS4OjoKDguAgIoKDP0DsoiXeNGpbxft43I/DvYfDBTrCKudGEEDJd...
https://github.com/zkonduit/ezkl
examples/notebooks/set_membership.ipynb
{ "cells": [ { "cell_type": "markdown", "id": "cf69bb3f-94e6-4dba-92cd-ce08df117d67", "metadata": { "id": "cf69bb3f-94e6-4dba-92cd-ce08df117d67" }, "source": [ "## Hash set membership demo" ] }, { "cell_type": "code", "execution_count": null,...
https://github.com/zkonduit/ezkl
examples/notebooks/simple_demo_aggregated_proofs.ipynb
{ "cells": [ { "attachments": {}, "cell_type": "markdown", "id": "cf69bb3f-94e6-4dba-92cd-ce08df117d67", "metadata": {}, "source": [ "## EZKL Jupyter Notebook Demo (Aggregated Proofs) \n", "\n", "Demo...
https://github.com/zkonduit/ezkl
examples/notebooks/simple_demo_all_public.ipynb
{ "cells": [ { "attachments": {}, "cell_type": "markdown", "id": "cf69bb3f-94e6-4dba-92cd-ce08df117d67", "metadata": {}, "source": [ "## EZKL Jupyter Notebook Demo \n", "\n", "Here we demonstrate the ...
https://github.com/zkonduit/ezkl
examples/notebooks/simple_demo_public_input_output.ipynb
{ "cells": [ { "attachments": {}, "cell_type": "markdown", "id": "cf69bb3f-94e6-4dba-92cd-ce08df117d67", "metadata": {}, "source": [ "## EZKL Jupyter Notebook Demo \n", "\n", "Here we demonstrate how ...
https://github.com/zkonduit/ezkl
examples/notebooks/simple_demo_public_network_output.ipynb
{ "cells": [ { "attachments": {}, "cell_type": "markdown", "id": "cf69bb3f-94e6-4dba-92cd-ce08df117d67", "metadata": {}, "source": [ "## EZKL Jupyter Notebook Demo \n", "\n", "Here we demonstrate how ...
https://github.com/zkonduit/ezkl
examples/notebooks/sklearn_mlp.ipynb
{ "cells": [ { "cell_type": "markdown", "id": "cf69bb3f-94e6-4dba-92cd-ce08df117d67", "metadata": {}, "source": [ "## Sklearn MLP to ONNX\n", "\n", "\n", "Sklearn based models are slightly finicky...
https://github.com/zkonduit/ezkl
examples/notebooks/solvency.ipynb
{ "cells": [ { "cell_type": "markdown", "id": "cf69bb3f-94e6-4dba-92cd-ce08df117d67", "metadata": { "id": "cf69bb3f-94e6-4dba-92cd-ce08df117d67" }, "source": [ "## Solvency demo\n", "\n", "Here we create a demo of a solvency calculation in the manner o...
https://github.com/zkonduit/ezkl
examples/notebooks/stacked_regression.ipynb
{ "cells": [ { "cell_type": "markdown", "id": "cf69bb3f-94e6-4dba-92cd-ce08df117d67", "metadata": {}, "source": [ "## Stacked Regression\n", "\n", "\n", "Sklearn based models are slightly finicky ...
https://github.com/zkonduit/ezkl
examples/notebooks/svm.ipynb
{ "cells": [ { "attachments": {}, "cell_type": "markdown", "id": "cf69bb3f-94e6-4dba-92cd-ce08df117d67", "metadata": {}, "source": [ "## Support Vector Machines\n", "\n", "\n" ] },...
https://github.com/zkonduit/ezkl
examples/notebooks/tictactoe_autoencoder.ipynb
{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Autoencoder Tic Tac Toe Verifier\n", "\n", "This is another approach of verifying games but using an anomaly detection approach instead of classification...
https://github.com/zkonduit/ezkl
examples/notebooks/tictactoe_binary_classification.ipynb
{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Binary Classification Tic Tac Toe Verifier\n", "\n", "We create an ML model that verifies TicTacToe Games\n", "\n", "Make...
https://github.com/zkonduit/ezkl
examples/notebooks/variance.ipynb
{ "cells": [ { "cell_type": "markdown", "metadata": { "id": "uKQPd7_5ANe-" }, "source": [ "# Calculate the variance of an asset \n", "\n", "In this example we will calculate the variance of an asset using ezkl. Here's a diagram of the process:\n", "\...
https://github.com/zkonduit/ezkl
examples/notebooks/voice_judge.ipynb
{ "cells": [ { "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ "# Voice judgoor\n", "\n", "Here we showcase a full-end-to-end flow of:\n", "1. training a model for a specif...
https://github.com/zkonduit/ezkl
examples/notebooks/world_rotation.ipynb
{ "cells": [ { "attachments": {}, "cell_type": "markdown", "id": "cf69bb3f-94e6-4dba-92cd-ce08df117d67", "metadata": {}, "source": [ "## World rotation\n", "\n", "Here we demonstrate how to use the EZKL package to rotate an on-chain world. \n", "\n", "![zk-gaming-diagram-transforme...
https://github.com/zkonduit/ezkl
examples/notebooks/xgboost.ipynb
{ "cells": [ { "attachments": { "image-3.png": { "image/png": "iVBORw0KGgoAAAANSUhEUgAAAywAAAV+CAYAAACUGLpbAAAMPWlDQ1BJQ0MgUHJvZmlsZQAASImVVwdYU8kWnltSIbQAAlJCb4JIDSAlhBZAercRkgChhBgIKnZ0UcG1iwVs6KqIYqfZETuLYsO+WFBR1sWCXXmTArruK9873zf3/vefM/85c+7cMgCon+CKxbmoB...
https://github.com/zkonduit/ezkl
examples/onnx/1l_average/gen.py
from torch import nn from ezkl import export class Model(nn.Module): def __init__(self): super(Model, self).__init__() self.layer = nn.AvgPool2d(2, 1, (1, 1)) def forward(self, x): return self.layer(x)[0] circuit = Model() export(circuit, input_shape=[3, 2, 2])
https://github.com/zkonduit/ezkl
examples/onnx/1l_batch_norm/gen.py
from torch import nn from ezkl import export class Model(nn.Module): def __init__(self): super(Model, self).__init__() self.layer = nn.BatchNorm2d(3) def forward(self, x): return self.layer(x) circuit = Model() export(circuit, input_shape=[3, 2, 2])
https://github.com/zkonduit/ezkl
examples/onnx/1l_concat/gen.py
import torch from torch import nn from ezkl import export class MyModel(nn.Module): def __init__(self): super(MyModel, self).__init__() def forward(self, x): return torch.concat([x, x], 2) circuit = MyModel() export(circuit, input_shape=[3, 2, 3, 2, 2])
https://github.com/zkonduit/ezkl
examples/onnx/1l_conv/gen.py
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])
https://github.com/zkonduit/ezkl
examples/onnx/1l_conv_transpose/gen.py
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, inplace=False): super(Circuit, self).__init__() self.convtranspose = nn.ConvTranspose2d(3, 3, (5, 5), stride=2, padding=2, ...
https://github.com/zkonduit/ezkl
examples/onnx/1l_div/gen.py
from torch import nn from ezkl import export class Circuit(nn.Module): def __init__(self, inplace=False): super(Circuit, self).__init__() def forward(self, x): return x/ 10 circuit = Circuit() export(circuit, input_shape = [1])
https://github.com/zkonduit/ezkl
examples/onnx/1l_downsample/gen.py
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), 2, 1) def forward(self, x): return self.layer(x) circuit = Model() export(circuit, input_shape=[3, 6, 6])
https://github.com/zkonduit/ezkl
examples/onnx/1l_eltwise_div/gen.py
from torch import nn from ezkl import export class Circuit(nn.Module): def __init__(self, inplace=False): super(Circuit, self).__init__() def forward(self, x): return x/(2*x) circuit = Circuit() export(circuit, input_shape=[1])
https://github.com/zkonduit/ezkl
examples/onnx/1l_elu/gen.py
from torch import nn import torch import json class Circuit(nn.Module): def __init__(self): super(Circuit, self).__init__() self.layer = nn.ELU() def forward(self, x): return self.layer(x) def main(): torch_model = Circuit() # Input to the model shape = [3, 2, 3] x =...
https://github.com/zkonduit/ezkl
examples/onnx/1l_erf/gen.py
import json import torch from torch import nn class Circuit(nn.Module): def __init__(self): super(Circuit, self).__init__() def forward(self, x): return torch.special.erf(x) def main(): torch_model = Circuit() # Input to the model shape = [3] x = torch.rand(1,*shape, requires...
https://github.com/zkonduit/ezkl
examples/onnx/1l_flatten/gen.py
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) d...
https://github.com/zkonduit/ezkl
examples/onnx/1l_gelu_noappx/gen.py
import json import torch from torch import nn class Circuit(nn.Module): def __init__(self): super(Circuit, self).__init__() self.layer = nn.GELU() # approximation = false in our case def forward(self, x): return self.layer(x) def main(): torch_model = Circuit() # Input to the...
https://github.com/zkonduit/ezkl
examples/onnx/1l_gelu_tanh_appx/gen.py
import json import torch from torch import nn class Circuit(nn.Module): def __init__(self): super(Circuit, self).__init__() self.layer = nn.GELU('tanh') # approximation = false in our case def forward(self, x): return self.layer(x) def main(): torch_model = Circuit() # Input ...
https://github.com/zkonduit/ezkl
examples/onnx/1l_identity/gen.py
import torch from torch import nn import json class MyModel(nn.Module): def __init__(self): super(MyModel, self).__init__() def forward(self, x): return x circuit = MyModel() x = 0.1*torch.rand(1, *[2], requires_grad=True) # Flips the neural net into inference mode circuit.eval() # Expor...
https://github.com/zkonduit/ezkl
examples/onnx/1l_instance_norm/gen.py
from torch import nn from ezkl import export import torch class MyModel(nn.Module): def __init__(self): super(MyModel, self).__init__() self.layer = nn.InstanceNorm2d(3).eval() def forward(self, x): return [self.layer(x)] circuit = MyModel() export(circuit, input_shape=[3, 2, 2])
https://github.com/zkonduit/ezkl
examples/onnx/1l_leakyrelu/gen.py
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])
https://github.com/zkonduit/ezkl
examples/onnx/1l_linear/gen.py
import random import math import numpy as np import torch from torch import nn import torch.nn.functional as F import json model = nn.Linear(1, 1) x = torch.randn(1, 1) print(x) # Flips the neural net into inference mode model.eval() model.to('cpu') # Export the model torch.onnx.export(model, # mode...
https://github.com/zkonduit/ezkl
examples/onnx/1l_lppool/gen.py
from torch import nn import torch import json class Model(nn.Module): def __init__(self): super(Model, self).__init__() self.layer = nn.LPPool2d(2, 1, (1, 1)) def forward(self, x): return self.layer(x)[0] circuit = Model() x = torch.empty(1, 3, 2, 2).uniform_(0, 1) out = circuit(x)...
https://github.com/zkonduit/ezkl
examples/onnx/1l_max_pool/gen.py
from torch import nn from ezkl import export import torch class Model(nn.Module): def __init__(self): super(Model, self).__init__() self.layer = nn.MaxPool2d(2, 1, (1, 1), 1, 1) def forward(self, x): return self.layer(x)[0] circuit = Model() # Input to the model shape = [3, 2, 2] ...
https://github.com/zkonduit/ezkl
examples/onnx/1l_pad/gen.py
from torch import nn from ezkl import export class Model(nn.Module): def __init__(self): super(Model, self).__init__() def forward(self, x): return nn.functional.pad(x, (1,1)) circuit = Model() export(circuit, input_shape = [3, 2, 2])
https://github.com/zkonduit/ezkl
examples/onnx/1l_powf/gen.py
from torch import nn import torch import json import numpy as np class MyModel(nn.Module): def __init__(self): super(MyModel, self).__init__() def forward(self, x): return torch.pow(x, -0.1) circuit = MyModel() x = torch.rand(1, 4) torch.onnx.export(circuit, (x), "network.onnx", ...
https://github.com/zkonduit/ezkl
examples/onnx/1l_prelu/gen.py
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])
https://github.com/zkonduit/ezkl