From abee95d3fa6baf3b41e72c6d0ff2482557443853 Mon Sep 17 00:00:00 2001 From: JernKunpittaya <61564542+JernKunpittaya@users.noreply.github.com> Date: Tue, 4 Jun 2024 21:51:37 +0700 Subject: [PATCH] remove batch_size, make tensor 2D instead of 3D --- examples/2.torch+state/torch+state.ipynb | 40 ++++++---------------- examples/3.state/state.ipynb | 12 +++---- playground/README.md | 1 + playground/example.onnx | Bin 0 -> 535 bytes playground/playground.ipynb | 0 playground.py => playground/playground.py | 0 tests/test_computation.py | 10 +++--- tests/test_ops.py | 6 ++-- zkstats/computation.py | 16 ++++++--- zkstats/core.py | 11 +++--- zkstats/ops.py | 36 ++++++++++--------- 11 files changed, 64 insertions(+), 68 deletions(-) create mode 100644 playground/README.md create mode 100644 playground/example.onnx create mode 100644 playground/playground.ipynb rename playground.py => playground/playground.py (100%) diff --git a/examples/2.torch+state/torch+state.ipynb b/examples/2.torch+state/torch+state.ipynb index 4383cbf..bbe70d3 100644 --- a/examples/2.torch+state/torch+state.ipynb +++ b/examples/2.torch+state/torch+state.ipynb @@ -116,28 +116,9 @@ }, { "cell_type": "code", - "execution_count": 6, + "execution_count": 9, "metadata": {}, "outputs": [ - { - "name": "stderr", - "output_type": "stream", - "text": [ - "/Users/jernkun/Desktop/zk-stats-lib/zkstats/computation.py:249: TracerWarning: torch.tensor results are registered as constants in the trace. You can safely ignore this warning if you use this function to create tensors out of constant variables that would be the same every time you call this function. In any other case, this might cause the trace to be incorrect.\n", - " is_precise_aggregated = torch.tensor(1.0)\n", - "/Users/jernkun/Library/Caches/pypoetry/virtualenvs/zkstats-OJpceffF-py3.11/lib/python3.11/site-packages/torch/onnx/symbolic_opset9.py:2174: FutureWarning: 'torch.onnx.symbolic_opset9._cast_Bool' is deprecated in version 2.0 and will be removed in the future. Please Avoid using this function and create a Cast node instead.\n", - " return fn(g, to_cast_func(g, input, False), to_cast_func(g, other, False))\n", - "/Users/jernkun/Library/Caches/pypoetry/virtualenvs/zkstats-OJpceffF-py3.11/lib/python3.11/site-packages/torch/onnx/utils.py:1703: UserWarning: The exported ONNX model failed ONNX shape inference. The model will not be executable by the ONNX Runtime. If this is unintended and you believe there is a bug, please report an issue at https://github.com/pytorch/pytorch/issues. Error reported by strict ONNX shape inference: [ShapeInferenceError] (op_type:Where, node name: /Where_10): Y has inconsistent type tensor(float) (Triggered internally at /Users/runner/work/pytorch/pytorch/pytorch/torch/csrc/jit/serialization/export.cpp:1490.)\n", - " _C._check_onnx_proto(proto)\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "text": [ - "==== Generate & Calibrate Setting ====\n" - ] - }, { "name": "stderr", "output_type": "stream", @@ -159,8 +140,9 @@ "name": "stdout", "output_type": "stream", "text": [ + "==== Generate & Calibrate Setting ====\n", "scale: [2]\n", - "setting: {\"run_args\":{\"tolerance\":{\"val\":0.0,\"scale\":1.0},\"input_scale\":2,\"param_scale\":2,\"scale_rebase_multiplier\":10,\"lookup_range\":[-56,64],\"logrows\":12,\"num_inner_cols\":2,\"variables\":[[\"batch_size\",1]],\"input_visibility\":{\"Hashed\":{\"hash_is_public\":true,\"outlets\":[]}},\"output_visibility\":\"Public\",\"param_visibility\":\"Private\",\"div_rebasing\":false,\"rebase_frac_zero_constants\":false,\"check_mode\":\"UNSAFE\"},\"num_rows\":2624,\"total_assignments\":812,\"total_const_size\":168,\"model_instance_shapes\":[[1],[1]],\"model_output_scales\":[0,2],\"model_input_scales\":[2,2],\"module_sizes\":{\"kzg\":[],\"poseidon\":[2624,[2]]},\"required_lookups\":[{\"GreaterThan\":{\"a\":0.0}},\"ReLU\",\"Abs\",{\"Floor\":{\"scale\":8.0}}],\"required_range_checks\":[],\"check_mode\":\"UNSAFE\",\"version\":\"9.1.0\",\"num_blinding_factors\":null,\"timestamp\":1715672095084}\n" + "setting: {\"run_args\":{\"tolerance\":{\"val\":0.0,\"scale\":1.0},\"input_scale\":2,\"param_scale\":2,\"scale_rebase_multiplier\":10,\"lookup_range\":[-56,64],\"logrows\":12,\"num_inner_cols\":2,\"variables\":[[\"batch_size\",1]],\"input_visibility\":{\"Hashed\":{\"hash_is_public\":true,\"outlets\":[]}},\"output_visibility\":\"Public\",\"param_visibility\":\"Fixed\",\"div_rebasing\":false,\"rebase_frac_zero_constants\":false,\"check_mode\":\"UNSAFE\"},\"num_rows\":2624,\"total_assignments\":686,\"total_const_size\":303,\"model_instance_shapes\":[[1],[1]],\"model_output_scales\":[0,2],\"model_input_scales\":[2,2],\"module_sizes\":{\"kzg\":[],\"poseidon\":[2624,[2]]},\"required_lookups\":[{\"GreaterThan\":{\"a\":0.0}},\"Abs\",\"ReLU\",{\"Floor\":{\"scale\":8.0}}],\"required_range_checks\":[],\"check_mode\":\"UNSAFE\",\"version\":\"9.1.0\",\"num_blinding_factors\":null,\"timestamp\":1717511682308}\n" ] } ], @@ -171,7 +153,7 @@ "def computation(state: State, x: list[torch.Tensor]):\n", " out_0 = torch.sum(x[0])\n", " out_1 = state.median(x[1])\n", - " return state.mean(torch.cat((out_0.unsqueeze(0), out_1.unsqueeze(0))).reshape(1,-1,1))\n", + " return state.mean(torch.cat((out_0.unsqueeze(0), out_1.unsqueeze(0))).reshape(-1,1))\n", "\n", "error = 0.01\n", "\n", @@ -190,7 +172,7 @@ }, { "cell_type": "code", - "execution_count": 7, + "execution_count": 10, "metadata": {}, "outputs": [], "source": [ @@ -210,7 +192,7 @@ }, { "cell_type": "code", - "execution_count": 8, + "execution_count": 11, "metadata": {}, "outputs": [ { @@ -218,14 +200,14 @@ "output_type": "stream", "text": [ "==== setting up ezkl ====\n", - "Time setup: 0.6220359802246094 seconds\n", + "Time setup: 0.5458400249481201 seconds\n", "=======================================\n", "==== Generating Witness ====\n", "witness boolean: 1.0\n", "witness result 1 : 12.5\n", "==== Generating Proof ====\n", - "proof: {'instances': [['cde936180fb7e379a578309232773e02b017d59f9001712b917a148b525d7b19', 'a38c8628cd223f38f854eade2722b8dd09b5797a0408398dd3d5160b6584e90b', '0100000000000000000000000000000000000000000000000000000000000000', '3200000000000000000000000000000000000000000000000000000000000000']], 'proof': '0x04e788bb02858310a749cffae4a10707df97bd2f4cbcd25d1ae77a91745cf1b625124a4099ee70b7ea08704d16f98955474883b249ae30e471e8d29b4c00c6b92c31afb2f95fc73f2464030d710a977561c3c9e87d82e08d5170c88e6fbb8b991a436f823e1b793a32e3845fd3c02f547f3bd6de661547bd2e1bae4d9a78bb9420ac32cb316fd3282ec17b06d6daed30991a679e955302e0226bbf01bd4d0ec52c3851ba90f370f0b4113f63ce41999cbd261edf44743fdcf9b52847763bcc7a11815eda358d8caa851714802e7c6a676091d573ec5efa73ec91e25b4b7c272601dac029a29452998ca66a574e979cf59419f8afc587f46e185b6d5c8f13479d06faeb2d129290de10f97afd9ff3bdf2344b5b35cfb8aef652b10f61a0fe930200ef656cea8ed3026a6d7a1e73de97d7c4c9e9da3e5e05392b505f1c823b928e1b1613bee5c5264045739d71ebb5724a4766811388ca3f58cfe8fa3b99abfd5a2a32195a9ac62ef3abbb9bfff509315857a886d834246a53dc411ec944ae4b2f19badfcbdee97087066658c971f8103dba45b0dfa8467fcc8efad750104543e32c6c24aefed41c8b7a4cd59ea9f5367baf73f6a7aad4a5b24f75dc11a5891cf707dd42ac7e2f0465d15275c4c5dfc139ec50a6deed2e519143d2f6d28d10b41610a52cec10ba43ac42b2709644a6a099597befad6759d2fa63affe244049977915a07b963d5081e1c6e8a85a146f963de34d72c03d596d8fa5649c9e6cec34f11fd9a427d068074a1c4ee16b0cfcf8d093189c74fa6823e7bfe23b08e673071e2ce505a968b8b621e7986d32588f1680a37d4df0fe3053df6f323981723caecc002e182d7978bfcd74aa999e7c065f64c1f245367acca4e926663ec0dceb903d01df0f3c91bba6a89a28b7126a900adf7ddd591587da556d84ce2384c6cbe2b104cf857dff76a0546b63ffee7dc2659285551edbaf376a2616f7c874bebb12de131da5b701d97032957012500c5665a503bc39c992fe25597cbcbfa85ed72b17196875c784e7aafa1a439b2bacf967ccf5bc7ad8cefefab7ea7560632fd147d70cf28627b8b5a6d6dc4a06afbd956978c0daead1ccb3d427a85da8470dcf0d491d1a477c6ee70a8aa59493afce492f160810f1af2489b5e67e9a44ffb7e51da8161377416d8cbb451075147c682ef3ceb7dd50cb874f4d3cecd973e4434b60d512106651494e9a0f64c81b849c2dba84b44cd19fb74299d861c8ff68c2fbbcd50ee87cf567e1807155e4907cbcd812bc7d929a1503473e1374f1ca39a6681edc167032c9eb00c8d95644f08fb0ae226b95c5eee1d3bb68aad06ae0759139d4921afcee6510987d3a3fb0195271bdf77220cd846c5dcfa5b5aab130925da8b9e108deb99e32f54a6dce1f893126e5694de6ad3ee5d23872c2322651ac67ee2eb41afcee6510987d3a3fb0195271bdf77220cd846c5dcfa5b5aab130925da8b9e108deb99e32f54a6dce1f893126e5694de6ad3ee5d23872c2322651ac67ee2eb427681a40fd5cc3f17dbc9d5754bc304b87bbbdf98c42c6572453fb34bb20f4582efab3acf760227538d3c03e8ebead64603a6fc1d77a644290c5229405e18bdf2846c27f674e7ab343e6f2c5f87885068602c71d69de12237fce13c22bf146bd01f9d7cd5dcb7d40c9bdc470c76bae448d0c17a59d63ee83f49fc7f624a9ebce083ee74942dcfc28bbdc38993b3263230ce1e01172450ca04c1c1d2e65ef7a551540fe612217d12b9c1992a73bf5241015bbbaa8333a8e3e5f4eccf0f856ba5801df14a3d691d49310138fa0c26914190a5f585c2ead42ed8a6930fdf7f1c2cb2d063a3e28df6fa4ca82c79852fa13fbc491424a6eaec003ecacc40be6e0f77114b58b74956b1f92a32776e80678f01d5136cd8924951c9565ae7e5bfdb43c6f2937f935ee4b055aac749a7297d0b7a04afdf2bcdfdd1071a31d13e850b51d94198b84bf7d815339156510b72211edafcd24806e6d7b99636b49265d7f0b11351d9d98bc4562412525673e3c538e7475cd9051eb214a2b825fd10e4dd08d5c2822312ce8acccb7801f15608943dd9b7f02dde2c2d3a7ab3cfd962fb15fe842720f44f6568367e0a4226a2e5d7a793adf89048f4483be49d5f0feaafb3e54fde91aa30301ac7e93f0517a921a552722217fc812263c307ca89711d0eefa06917001ec0ac51e390e73b39c9203c954cb05e8c62aab71757e1a1d654c2a2970e63d0a788a992a9d18c5c7919b9d3ef3a16b6f3bdd6d8a23f5cc06633c16861002cb20df0a8faa54237e71e1fcd69fa6bf80b743e0789caebdb5ef5d3d6d0691429e1b57c3cb618425a6c4d17ba0b588219ef5920b1c11c20f01f98971aa1a2ffbf62fe255c28c92534ceb1d0b7238bc24cce0b21ce45f9f29c5515dbaa1fa71a0f90eb6a484e74cd12fb512187a4ae3ea60a6e6abe1aad1df9d5fc2285763848bca257429ef1c05f6e8b33d1889a45c86d41d65ba1939d172b0e0006c365d74f53413e5b4b3e800cf8c89ef4480269bfca287fa92ac08a363117a86b018e139b1da1eb754c6fdbcbb966f5fe3bde70a6dddbae9f940d47bac46108124410d03ca1211116aae05b7d04dfcee624418e05d8a8822416a678304be1cec08c05b0ff91601a600463d3bad6ca4a036fb0cb7f57f2eb581c78927b85df1ecdd6311f3b66f2a23249f45cea37adb230cae78e32f072dd3f211de7728de699805f76046169c0ad724c64908a31a621517a6247110ff4b2aa5341bf8bf4225f39eabba341ed627ca43354e9fc058c2079876e53a2b86632d8df899f1a17b35cd388f8176072e206a778df79d06f61ba3e69fdb1bbe17232b2ddaebff66e23af8d9fdab6e78f52dc1f26aed9ef9eada475429f43ec35fbe72ef9f75dd71e1aa21d792a352ab4f17d916bd19de8d8dc3a3a167d87015f4374fac3c34c726391fbe1c94763697cc2085b862caad2de7451201fc82c68a931087fc5add300ad36cab7de55676287d141e1f1d544f8fcbd8d71caab610e818b06311fa35ff7d849b2799863adc640e2ae8d6ac8577d44d7bfca6d703f2b8a5cac0ec7101ce3cdf68198e4a93f28eec2757dd982aaae2594ed19f00bdf39bddb40e9142e23d6d30ba7dccd3b844dd050b5932887425fd9c93d2fab2c480736f30190e02e791503dbd9c3f45c7e0535d2183d6b44f62ce53d532187e7e06e34ef9eabff2c0e8962f0fb495e4ee2cf473017c037332efb29a81dcf9ca6c05645bd77e4f3dfcfd62fca4403e3e636d3bba0b0d2ace6a3d91aae15e093989d11dedb75ea282051cc392a52fe2a3999733141415249b7fcf74c4f370c40603fe308625159fcb88b3514201df8eaab2aa69412049ccc2bafd3d3afb86e3ac8a15daa5f713ccfeb96aaaae06836c3c4e513b4d14d9e629a1045c15e1fdd2e6faee3be7a1f98414fca64407cd3bd4fd3f0f86020a3ef049dc6a28b989a425db6210623870b1ae849574d9a9ccd261d9ab4f64e2179e9e5b4321e20cc0bba5604698a792cacc1e1c96cb4f2d0b6147cd5ee4bda527f9b9ced393fb717e04d42db7d756034cd3c60439f1cf88a624aa5265bd3af5245da03caebef56cb729b65bb1fb9cf856328889a840793cb91da7886d61a5a712dd92c1ba7ab7696d67cf3c9023746ba272bfec22996c79a5e757990f8a0bc40eef2da940ee5138c7561a4ec32c5c65897b1654d34ceeb25b76c911a4a30ed30d0f050412321456a2443a27164e4034b369eaf2fc30b8f9120a0cb6622808e514da35eb200e295a3d9b83edbfb403ac8fa8400f5a942bbac6b43aaa8ab3cc76039ca40c0e6a79d6e7d1eed60b722f4c6f06f7646f1a2dc67ee5c8cb2495a2592afd4cddb25027b24a99a443b23c6e48a85268649d3ac3db20fa352793a4c2cc0e27e94aa82e35662ce757fe933ad62a0762f702593a575c6758f9cac170da5a079f3c6d9d8f06facb6521d2882018064afe2e2d4c754ad9aa1249207b9aedae045266695a5222cb681475e005c72ee35be0754716e87cab8c4fa65303b703962ae131faeda7b05a5b91d977f9d4dff9d891dbd44e50128bf528486f35fd2cd316363440a8acede8a312690435237c26bad8cd078994f0462ca5f93c10106137214383761b599f0a9c80870eaab4d2bb66a5e4b52e10565af5ad5228283080500a88e1f00ad6a6832489ad970490e58154ac79ae151a09c29ecf80c368266d2c1da236910082b652c6733e6921ea0536835bf864448eece2f4f7cb5e5d131867039b859428a0a76e635d0426176fcc29e1becddec2f2d6512691d4b387433c75060ed5557fdcdb5f6df7460ce62536fad1110e4b8520935909c9c020249080c7000000000000000000000000000000000000000000000000000000000000000010b9876665074f8ad5097df28fe8aa4790bfa52824c8c242a04fb739956aee4d214ab279fa5e439827ef88e5ac710c40861d223553f42c9dadbeefcf1d0e301a00000000000000000000000000000000000000000000000000000000000000000653bebdc506442007206b1a8ada9c75b1a413f21c199ea7af14869094d2f67e225771e6ff7a625047d8bab6b4af10534b8514c4cf9aea4d5b1d2ec0486c8f5f013c89d6e128893697a071a6e5065c4bb609a47a89b41277657053a0e1a48314000000000000000000000000000000000000000000000000000000000000000008a2644d00af93e717c5075a739f09abef85867524d1785e9d05444de73f01f107d836d6f8dea6d313b9a2076cadd5ae2d302ff0f07b1eda2e801ee1ae4b314000000000000000000000000000000000000000000000000000000000000000001c57ce61da1ee48962fa4a1cb5c9995ac3c232d84f0f548d7bc18b02cb84f0d6000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000023852102a9216f31a8daf8619539533d1f3717d21a447528abfac61ab70ad1930380aa1037fe2ed10446fe5924cdaee1c2aeffdf3ca934389f0f980e51a5126629731697b47f629b0fa18017acdebc16e7524199c99a16f9e92b8bbaaabfc97d10192e1ba54ae182ebd02419f7060d96c1b4fe034448c396d59d4ef452118aa70cb209df776c9c80a16ceef48cc6349d0b722edf4cdf5df79ff65a63207a8b1e11fdaddd0e40f4a25cff902fe371ce349677f7f6563f8164ab0855e12fbd78f4000000000000000000000000000000000000000000000000000000000000000010effbcd5328b97badb3ae98e80d12158fd4570920fc3ec305d14757ac902dad160eac193dca3a861f0f1588e7ce1eec2eb29154860ec30710f0bb140489f88d046d9c2865d5c9c31876047ec73cbb342078f4d1e65985f1d92c14a2f934660f2ee26cec65ad22cbf359e3e495eddd40c8042ab8954723aa0741d288c967cc7909f4e8a46e77a8bbca08d357ad232a756bb524b203e776c426af4f0fe50f0a5b1d335d92da85beae4dd19947e493869e03ea859eae3348983944ac2b53195c8e00d4e835951ea53aad5dd9581ab8faa538269d9b4683c3a219737b80f5b8d681185206dae67e6603884ec034eaf41e4765a960dc18b4fdef416d6c2b23aa861c1cf35ef77ed9e0b7e535cac36f112d1b2998b09ff6d977341976f4582cf6a8201c8697714e298247005f0bfd7cb6c38021d58e5b468ed601c96116edb2d89ed21990015a6ca9f976cf0adb55acea461d53c5c54202420987e539dc04bf2fa9021f23ed7a158ce645a9bd4bcdf7f939bc35d4b27df3a8af46e0333e07cd709eed2136e96f76f6a87b5eda1502d1f64adc76e649295d6e201cd77d56ac5e704714260eeb719414832f6eeb5addff47117f7deb64c48678c8141a6145b24c23120424aae212d9b477dd75ad1b746cb39cc534c140d7a026749ff33e2aed780739240d9d6897ac8f141dc0f37a5abe666c067a9ea37e9e5ca4be726b7cb235d72ffa14914ca8d62b4b2e039e46ca10e47f1fb9600ba58c471fb45cb3898db27a18e11ea0b2960d2989ea6d791f83d2c5745a754eb6d20c8963e50115fa34db5acdda2372fdbeecc3554cd419b5e9adcc29030b65d76f7b1c038c43585143950575c21a8d468b63bbf5ba5bccb65a35a44415d80d0cd1a8d81181935f90d0ae264cb60532b6f06476070c8179fbd76f9008c53ab8a46bb4076a4d935e5a029b3088a503ab444cff2cd9a759c0388f768951fc95268a751583fdf4f553fb7bb80c0b270346ec310583c79c1c971c869eb69a39a37bd1c9f6222cbdba47c1d5a66a68a70e70a32829db4a4b5a864f915acfece42db6ca8dc3bb4199145d5ca9c672cb752243279f41a3e1151369c58e724fd5c79a9679a954e195f25d21c3377d4644302f0d6f67471d888e93bf0b948630d27e84062ae6916038fdabc504d8fc9b440c08055945201cb4ca7a4e469f92cf013ca1a4e1b860f5e4c36ea1b2ebbd2096c11bf95103213d24117a176bae1a1ed0cb5944cf7fbf4391d71eb3d0e0778a0c4814aae1b4e3f7ee69f9b847a863b81a376ae3ef107290df9162e9b54d456ebebd1abdce70499dce0cf995b207c809a72bd3a86ef46cb9822ecc952182472399d91a8898de1174fa8fb99c862bfdf54f5a0df66aa0dc769a94e09487bade12cec6177d8c457156b5c532349529df35baada93308a4221e28cebf8242e1120a30b110eeff4f180d36b21a93b81af0dffbd8a1469951cf117b6ca74caf5c1713ce9c189196fd2c67e7f7dca133e1214b27e3c559df6777d5131c5f8e563756a16e3914bb0ae2865239dd2b11077f7e245359fe72735bb3eb76eb988bcffd3d50d7b014405659be12fb1f731d9c778b5745bcaccf2e917f24bf3f739b406e82efc394151b5a0162784667ec5e1533bee8d8d0ad11ec70c92fe76a385c1e2a3ca2b8ca11092cbeef1e02e20567c591c60b45b087938c0eaa36561fa7d94b7d892c5bf4143d9dfc59ea7c5ae1e572137a90479c31b5068a805427759447b8a3cad78a562e794a271714c68928200907f5323ff26b2616f481006149023b2040fcd2bc5c13cec26362655a26f3ba9485cfc9d2439c62f4dcb027eea662d9b00d0cf0ce8329ea94d79616b943bf6960c6388dc51314b98002e4826d12ecab73278b27c1db2063cb10593a0f70fe44e5355ce60ccc7df6bd3edb063e3372b0ae14b2ca50ba08cc62c8b4f90eebddfa384db767237a9cb68e08a4d87e2a5952ba5e7dd8afed28a263349f4ef82e8333886c7f2d11f2f4ded7a55b318f4e7ae63e52d05c12c21e1af103451c3db15cdafb082a5d28064112d08093cc06face88617a5c01424c22e9d902dc2778e32e67a7d9fee7795fb8085730cfbfd5b61a9855d18e349ed128a263349f4ef82e8333886c7f2d11f2f4ded7a55b318f4e7ae63e52d05c12c22b328dcd68b2664d885f2a81f5d2b0b61295e03c611799bb1a06efb12366dc001b3b9f80f3266bb1236a75ba445d89d7a059dfe9ffca5ca018726bb9b50fab2020a1e2e29efdb2bcb5e11b68ae9e3429051509d42349b4723a727e5fc125139d27ecaf018856b8d35ba3d74651b2dd415490884272419fe5f447bbc81ab19a9e', 'transcript_type': 'EVM'}\n", - "Time gen prf: 0.7742421627044678 seconds\n" + "proof: {'instances': [['cde936180fb7e379a578309232773e02b017d59f9001712b917a148b525d7b19', 'a38c8628cd223f38f854eade2722b8dd09b5797a0408398dd3d5160b6584e90b', '0100000000000000000000000000000000000000000000000000000000000000', '3200000000000000000000000000000000000000000000000000000000000000']], 'proof': '0x2f9ea81e9410dfe76747bd025604d995a2bfb3f9d2c40f766368917deb4b259d1dc2dc6dc14269286cecb02e082ba31f28269080395e53edbd21fd38a38542320eb3c107d12d870f4e310acbb9b18a5f3fddb437cfb5bfe33579cbeeb7a6359815a9e1484d05203ba45b995d16c01e4f71a198be83c15b8ad761081f8c81583b18c7b4b512e3e5f5687de7fa5ea290d3be351443a7cfd488e06e9733e21103ac100e87a31f45f6bf932107e3c170a43ab52a53ebf43310f88aa0dde4ab2792b42f6d0d1b101bc90d4f30f570288537bcf6763b7cc11281f637d6ba12a9019d042f2fa4a1de8d5589387014195ea0ef35eaf00063ad832bda9e710e6dd59fbe270262ae05295e8ea3f6c406640cc241ffa5023af16e1017100b4c7c49b28128a220ab8564b9695cea8b2726875fab46ccb1ffdd94f588f36bf91e90e2ef9fc56e290bdf2119eef2ee761f7d3bcdee6045cba6297bca83cae69421d51024306b000f152e0454c44836199123ed32c2afb1390486b61d84c4b72a76cc74af734f3b108452a44ba356cda2076346eefe1cdadd3a93ed13efc2a3e2fb969bc79f6eaa17711c411b04c66a931006c92b7709b9dc5d7fd595914ae625b9d33df1f21562140423d940dd716f779eb8107876f30fe0654edb2e99208b9207a400b4c278332d720760e09173b46091b6c5873f20825a145332169fb55b45201648c18460011ec81fc23caa3187eab2a7f04d8c6232321f9670a5158bb14639d0585e7950812db7c604fadeb97b8da0b6793c32a175914174431a070b037e74536f33f025c123a2fa010a13d1f21798b3c92070a274b9c8134c37033272b450529ed95365bf1cc4a5aa19f34b5c2f732517747f439651cafc61b23b414d6cffab389e8818de0e79043cfeb18296baec4683050cd1aa295815e7862a964616dc33a64fb7b8bf276ac83be48add931742f9938641608574c63647a04417a2b92efaee6b4b294c161377416d8cbb451075147c682ef3ceb7dd50cb874f4d3cecd973e4434b60d512106651494e9a0f64c81b849c2dba84b44cd19fb74299d861c8ff68c2fbbcd50ee87cf567e1807155e4907cbcd812bc7d929a1503473e1374f1ca39a6681edc167032c9eb00c8d95644f08fb0ae226b95c5eee1d3bb68aad06ae0759139d492131da5b701d97032957012500c5665a503bc39c992fe25597cbcbfa85ed72b17196875c784e7aafa1a439b2bacf967ccf5bc7ad8cefefab7ea7560632fd147d70cf28627b8b5a6d6dc4a06afbd956978c0daead1ccb3d427a85da8470dcf0d491d1a477c6ee70a8aa59493afce492f160810f1af2489b5e67e9a44ffb7e51da823dc92beb09da81eeba66c04bd3b6c7d6f2126085d5a92480b98831dcd8c48931ad34f2529573e0767972f2bbf91788d3744f8dac285958719a1396688e8175c161377416d8cbb451075147c682ef3ceb7dd50cb874f4d3cecd973e4434b60d512106651494e9a0f64c81b849c2dba84b44cd19fb74299d861c8ff68c2fbbcd513ad860d92c675f157c2ebf4e2c10acf58ac4615b79d9fdd24c9533459bef5b3206bf306ee92986c1e5f9912f0df863ca5afa0dc4550948de77e232bed286dc509cdbe1e891e636a1c74d333a488c864204e9baf3f0899c617e0cf3a681891381c0fa739c3bc4b35f8dc73149299df47da11f1048583f9a20688a90ed0081f45246b05a4760c396e6db87954bd37d70bc7b89707dd034447c3a60fcbee4cf3df082d0addb50b0bef548a528cf505931bc0cef8a16aae67bb1c804b79544bef431a2caba850789b82bb527f15a1e1a9b6b6e80582f7d4db58f8001c203e1ad6720fc11e170d2b7127da140646ce7eb9c36924164014c4e10e759874b337e2acac1c776ccac189ce0e3b8a19f5ba4a75ce62439a48b124241d5c21b9bb6ade8e342dccb036543a248499096d225859fdc3ca04d32fd9cca4da521e54f6aa0bed5526d483e6cab13041741acd47f1c7543d97ba433835a3ef12b836d95c0cc03ace0ff4a8f1d467f02f9cdee8cb1509ff27d19c1885a31cef39910ec41ec968c71e2c8a41cabda88bb44e230f4dd3995876e2daf0d8374851db55ae0707d79bd2c905cdc4ee5e7c3dca4246a6b84bca696ca031bc8aeb7c06d36d6cb8ee24937210263744d11790d780b45680544511d2fa7f7625228b6381c8076e3b02fd9393ec2b3382277efd52b9b400ff86d4272026d2296bfe55d03141e9ab747076901885276ec5f2c790d8e35a6eafb37765267eac84d6ced1c419881db6d65cf958ef801ebad386bcf32235d653d46c209fb3e312c5c21e36118b9cacbf5c73bec0239d096a412848646239982d5c1694de2ca1b36bfa793867a3e84307bcdacbe16f5c305243f8fdc4271c7e0fe2a58101205d9a607af964f5b164cd0ec398892dd70f1558b8a192e242ad3062449f5b2d7f80ed2aea7e37783abd5df408dbbcfd6d592bc5f4adfacdc33ab555dea7ac66c6d77e176d9bb52741881ba805d5562d80a41b38500290ffa3515bdfb5d4940ca5f7f7117a153e42f2b056485ad2e44c74b216e5db55b6a3c4b3c50587287f187bb17a2f53f6c5d03a50ec96fe1a74e1683e20a3922bf9326b5f04569f835b83f2d7e757c11c113f906bde61160f60d3e9d61b2911f469991a4e90c9076c5930006c25975daa2a86cb8b91916a0f7c8f7ebd0bc319810b01f17b52fd6119a06c5367298ffd2cf5ac68fdbcf6cdebb60d6fa7012175a54a7878accc9ceda6978738b9062c314f30d44fbd90f7ab7bab77098e251c5fa47d78d9fa350364e830be8a7a023a8432392f3e80aae31f216441d0df0eee191a53ec5292e4380681ffdb03f0344aa2ac4bfe10de66b5b178519b953f0012e7ee48c8c5642ea7125171466792d0105f50cffcef7dffe50391315c3ce123861de64d2c4f4cec63f6bc2335049d0191e853b5a53cd2949f532d516be2c6094e135b7d63f4534189f5b4322d5fb6a15813c96f2996abab79617cb90763642e5ce39df35d8c163320045673164c4927cc8416a190fe59ecc2f43691aafc2d246b248a8947119921b8788ff9bca033d763ca3d2faad762291e326e56496a21136f75aa16f45fdf377af949de89092ad859808e93c6dccd5b1f42ca944f70e90b810a59c7061babe0d52a9d92c668083856df75a95574085bd5fcf3c6d8681027b1fce6a082dbb39229765bdffec3099f02ccb3f7d39b21949493acb506c87e186b94535f073646a212838b0e6fb0a0b22c40f503b28687e63a9555d612b9642b1e01c6ae0785e42a54f5a52dfc6349046d4a9999be490b53567f0f9399252d0a9d6bccd7d7ecb506a807bbe1a00a3e02521857a2fbed894582a72e402035c31b26f903c1fed185e051e3d15eb65d4f44b68b8101d8e769307971860e315f280dc4117c0bd6100c2c2b5007647d8bfa1b75f9ff26ca3d00321a0f9dc874627e10e91bb5cb7002ee1cda0f3f8fbb3d74d3a18925235c8a9cf338b0716b1feba022dd8ef56ccae7a63f8d70c2733a96ac5d32c745efcf6d822a656df177871dd820984e0bb7754059e3ce9ab91baf38c0ed6e58ced5a15997191b12ad11df2d8f18d80edb5c3dc9c36082f2a233754d2fa57e9c28b043eea7a874e952b512fe252137cb602002b2d73698e9cd3f7089cc24a60b4aec0640e3a2e8c9bdf177093603b9c046ff168147a2e24196ea57bfb237d6b6cfd011a0bb0d9e5414ed6a66031e3374c21383c87a9940db8360fa0f5dac6dd93c69d53951b1c1287daa8633882cf4e1a6f57ab1fe1227c76b928395c4d6394467ded8a9bf3a728b85650082ca1c54d54f9f412579f35f34b736f04e087e69032fcfc90ae5f28d76b601018f421fd5c8adf523acc55af25e5454d3e9052636b477d3f54ca0ad4ad38c212784f10b35b4b727a755dbdf34904b3549e2ecc084a7c887a2a6470fe07411914edf6d03bf79d5efa221ba9981b9bcfc74798b54f86751be8e6b6436bc9b5296a9612f1b46d6541de854fd18062b60b9d36cb8797719e17334bfbd60b697ad434605e9133e4585a2c7d56c7b9d5dd5f78ea7d29cfde0d4fd6bb302384b85df6a4a72ab2da3808c1c6d1c3b8671cbc972cab63e54fac02f3a25781bd08ec99f15aa7b301e475baa4b0288dd8eb403426ca2e18006bfb213e4c8dd619ff4a4ccf8dfe56f07a6207b80f383ae35d2dfb21c4d62f567480c97a91ce71f8ec118b7e972a3572cf8a7d3d16dda88b84df27f968d9b4a96d14405f4f416b25af9096ab450c8db16b60085fdb2fbba8ee8a1a6d57159561fd64c932b8ab073704224f306499ba112c449de0b82ce052efac1472db0e41e4ff60b3cd2b527c16f93b51d916d9e710000000000000000000000000000000000000000000000000000000000000000192b8c031ad91225929d6045d76f85cf7a104ef833c9a5230ad161b948d89edb0ae86aff60cc2598868d197bc30b0f4c1ef99dcc01aee2755451732873c4f91e000000000000000000000000000000000000000000000000000000000000000022e578805f67664f26531cde5fb88a4411a834723b3f6b027d39fe1f61e5bcac0487b00214b4cf2afee8c11cbb2a8a97bd8e3840d9f7647f1f3d99f70a25975e2256913fc725eaae843d659ae14aa093c44cb23d24c3c0a75d81c8585e598eb00000000000000000000000000000000000000000000000000000000000000000001fb7251465cab12cace722a78fed05c7618a32bbb5eeba77ed65023668c5ec2fc474489bef2cb2428224c702c0abe30181929c6e4ff34aa03b38ac2525c9a900000000000000000000000000000000000000000000000000000000000000000079aba7d56bdef391b48094e63038854a8b42db78e444ce47536ed21428aa2a000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002d421c9d14ec6a897edbb655e2608772fb5530653af7180326ed879e665a9fa2faa10a9395b2ca6d66f0633f2f7b0dd09ca2b47860bd7dd9a6b73f3ab5011b32cbadc27886ea02ba7074c32b0fde7bdf4fc4c92a0554749cec6b66d46cf410d0a1ff996de37d8496f92ae615740dfc3ed20559fc9be7d6e00c43b8d7bc13906000000000000000000000000000000000000000000000000000000000000000010781075d4ff4ad834b50767b806ca29e5311eb06d47b054eb6ee1c707dd368a1e453472a662f628a64494674feff63eabcc4b71410709f1388cb11366392f9419e8511eb071f381069bea7a4049192fd5d80263f13323577c595708bc580d8f2183adaa184c1583e4eac1a527233a225dcd6fa712c46cc7cb04176a1b7977ba00000000000000000000000000000000000000000000000000000000000000002e1c34b05ce8f339ac9471ac6e039669926319b42b3bc1181b9d6eb2e93526750d8ab220294afd35488a41a0df2e87ad007571f3eced403825fe3b8718d7182e00a7aef48d1dac34ddbd28048ba8eda6d2e2dd26f3773485568e03cba4f852140e66f5467d2561d9aaf171c3eb6bdee6d9584430e4fac3ee162d7e61d96cfa7f1114de4bf41ab3b7a7889378a9e58ca193e1ef02d5055022f1194983e9488796091b61c5d32ab89218b74e69fbe5f68415cb5aad869789171f67288b23869383244635f4fe08cbf1259541db6056910daa37342a9f16f74d9f292fe2c5b006cd2c8e2c29f8ca1a2fb00bb9c8b7ce43ae8d505d7515366af589d652a4e84afc611af86357e198b0536322eacafd147910680106bc301c3feb586564e53196bc2c08218e5e56b428b526c52de00cfabf91c9bdd18968db0ce5397c984e27340bd9043d95da7de7624f9e9f235f8985602945a9248f37f00b80bc0080eba4c06a90090106baf044fd2b3122ac2819b583c77aca9ea93fcab7b0c11b69c46eacc6e1041ac23d21bab6dd75323e6a9c5781d8c7da1c1c8f232265fe330a739b0a7c330365b651ed47ef179a5aa2648f9d651e0be106ed4ebbdcb205952910098aa3192c9d5765e111a0e452f42d5e199ab28611bea9bca75d23afa6507909600e0beb20018870aa111fe4f26dee351a3ee17f2a2e31448a13caf84e8f6d3b15fb95601020442421e940bae8ca0fe44ed8eac24b46776d51c7c1e80382027b67e9e04d027273c2697d9a104c4c95bc49c7e6c5f77810aa10524f19567724806c23287e0195b02f2b7ce10ccc87defd99c2c42fc25ed957a8a9dab12cf30a13a926b89e1ebe1af08226f477330dff3caf5521027a8bef1242ec98ad5e9e623fe015a9fe2294234caa93dc6c65b657205df1c92df8842323b7a534a226af7f857a1f40f50bcc663303586eb5a14b4a5b27f150e014a555f5799bdec8f61cff213ec0c1522b77ca4f1f731aba4e4c576e7ae2b32fb85be3de2ebcd23d754b0f15f236ac661802091d968aee507036a26caace7a92a5120e216c3149c5354ec03d4e34f938123b6295f1530375c12394e77376c5b72c8edf97de682ed051e86a1d14e0cb5a10279e0f11b58be93d26c8d5c7b36b40c62a3bfbd8f751511120f6f1208e71f90f716a967df8ffd9c87b83911703fa1482dff755d11374aa58ef38c77101056401ac8ad1f82b66679de23828bff3c4bde8fa30e342e1886e5e80d6c2d8835a42183afb18025ea740e708d25960f3af42b9c67684a8390ffea5b6b9b37dd0e7401904bede1d0f9531a16e6582aa5b1b9a586de6aa08ff5a483112f0e51e3b71540c353f0bac4f3ea45ef9fab40cde91064315fe224f495f977682efdea5e243cf26a194a316a0a3f3ae09244af7c15f0722b9d3fa7118d5e7290f80b7ebf13efd0f61bddd7e08fc4904f63deb79ed0fd6e5f11d9e896ddad919429f384a8a1257033875ca23810ec430f8715aaea894d7cf1544c3e36d0b7ebfeb60966a859e631b3e3e42662ba52d091bbab9c50dd582808ab257b0c13437e9c42a6155fb6edb01f0796bf262bf079c17b0e301e6548d90aa1bbd90c05ac16c7fee06bcf3a09a2af5ec5e3a922750b2d7e8729ae4167048eda7409dea4bf34e7f02925225eec81e9c8540e4c4fe83d5b9f3bcfdb69bcd36f68849f88517adfc6bcac1e7a8228527d637d5de68968a5ec5d1e0072c2cc03fb0a4f7648c5accb57c20dde18fa83c2e55115f567ea8393020100982fdd0acc1f28bd4f68843dd1345d4e7cc6e5aec0870c2a26ecd6f43abb03dbce3f7d32a10fc274c669d8f2e0116fab9fe7c4ae629435a9fe083f8606d3c8f68fa8fae565c32596d173e2423338a4bf4ff8dc2d7265727f3514e86d8aa9e27948fd73cc43a21a9f17d3628b205e1c7df6378deea210cd5ee9bf3759735b41609e73fec342761af393e5832c8e62603a028d131791904bede1d0f9531a16e6582aa5b1b9a586de6aa08ff5a483112f0e51e3b71541aafb75798147ed701a3ccbc898808d206fef3ab92ed5ca3a02c10d1a43291b801420bef8de12ba4822a4a342b44696c257e45ab7043f857085cf085eec061da1b2948c07b1998ef7509ff51565e8bc0e26146626dc7baee7c419bb0563143da03bc5c86abc4c428c6ed83a3ff59eeb1ac5e595106c822ff7a370c4bb1f6456e', 'transcript_type': 'EVM'}\n", + "Time gen prf: 0.7617218494415283 seconds\n" ] } ], @@ -242,7 +224,7 @@ }, { "cell_type": "code", - "execution_count": 9, + "execution_count": 12, "metadata": {}, "outputs": [ { @@ -251,7 +233,7 @@ "[12.5]" ] }, - "execution_count": 9, + "execution_count": 12, "metadata": {}, "output_type": "execute_result" } diff --git a/examples/3.state/state.ipynb b/examples/3.state/state.ipynb index 45ccb5d..222f384 100644 --- a/examples/3.state/state.ipynb +++ b/examples/3.state/state.ipynb @@ -123,7 +123,7 @@ "name": "stderr", "output_type": "stream", "text": [ - "/Users/jernkun/Desktop/zk-stats-lib/zkstats/computation.py:249: TracerWarning: torch.tensor results are registered as constants in the trace. You can safely ignore this warning if you use this function to create tensors out of constant variables that would be the same every time you call this function. In any other case, this might cause the trace to be incorrect.\n", + "/Users/jernkun/Desktop/zk-stats-lib/zkstats/computation.py:257: TracerWarning: torch.tensor results are registered as constants in the trace. You can safely ignore this warning if you use this function to create tensors out of constant variables that would be the same every time you call this function. In any other case, this might cause the trace to be incorrect.\n", " is_precise_aggregated = torch.tensor(1.0)\n", "/Users/jernkun/Library/Caches/pypoetry/virtualenvs/zkstats-OJpceffF-py3.11/lib/python3.11/site-packages/torch/onnx/symbolic_opset9.py:2174: FutureWarning: 'torch.onnx.symbolic_opset9._cast_Bool' is deprecated in version 2.0 and will be removed in the future. Please Avoid using this function and create a Cast node instead.\n", " return fn(g, to_cast_func(g, input, False), to_cast_func(g, other, False))\n", @@ -160,7 +160,7 @@ "output_type": "stream", "text": [ "scale: [2]\n", - "setting: {\"run_args\":{\"tolerance\":{\"val\":0.0,\"scale\":1.0},\"input_scale\":2,\"param_scale\":2,\"scale_rebase_multiplier\":10,\"lookup_range\":[-56,64],\"logrows\":12,\"num_inner_cols\":2,\"variables\":[[\"batch_size\",1]],\"input_visibility\":{\"Hashed\":{\"hash_is_public\":true,\"outlets\":[]}},\"output_visibility\":\"Public\",\"param_visibility\":\"Private\",\"div_rebasing\":false,\"rebase_frac_zero_constants\":false,\"check_mode\":\"UNSAFE\"},\"num_rows\":2624,\"total_assignments\":1316,\"total_const_size\":281,\"model_instance_shapes\":[[1],[1]],\"model_output_scales\":[0,2],\"model_input_scales\":[2,2],\"module_sizes\":{\"kzg\":[],\"poseidon\":[2624,[2]]},\"required_lookups\":[{\"Floor\":{\"scale\":8.0}},{\"GreaterThan\":{\"a\":0.0}},\"ReLU\",\"Abs\"],\"required_range_checks\":[],\"check_mode\":\"UNSAFE\",\"version\":\"9.1.0\",\"num_blinding_factors\":null,\"timestamp\":1715672107649}\n" + "setting: {\"run_args\":{\"tolerance\":{\"val\":0.0,\"scale\":1.0},\"input_scale\":2,\"param_scale\":2,\"scale_rebase_multiplier\":10,\"lookup_range\":[-56,64],\"logrows\":12,\"num_inner_cols\":2,\"variables\":[[\"batch_size\",1]],\"input_visibility\":{\"Hashed\":{\"hash_is_public\":true,\"outlets\":[]}},\"output_visibility\":\"Public\",\"param_visibility\":\"Fixed\",\"div_rebasing\":false,\"rebase_frac_zero_constants\":false,\"check_mode\":\"UNSAFE\"},\"num_rows\":2624,\"total_assignments\":1111,\"total_const_size\":496,\"model_instance_shapes\":[[1],[1]],\"model_output_scales\":[0,2],\"model_input_scales\":[2,2],\"module_sizes\":{\"kzg\":[],\"poseidon\":[2624,[2]]},\"required_lookups\":[\"ReLU\",{\"Floor\":{\"scale\":8.0}},\"Abs\",{\"GreaterThan\":{\"a\":0.0}}],\"required_range_checks\":[],\"check_mode\":\"UNSAFE\",\"version\":\"9.1.0\",\"num_blinding_factors\":null,\"timestamp\":1717511715747}\n" ] } ], @@ -171,7 +171,7 @@ "def computation(state: State, x: list[torch.Tensor]):\n", " out_0 = state.median(x[0])\n", " out_1 = state.median(x[1])\n", - " return state.mean(torch.cat((out_0.unsqueeze(0), out_1.unsqueeze(0))).reshape(1,-1,1))\n", + " return state.mean(torch.cat((out_0.unsqueeze(0), out_1.unsqueeze(0))).reshape(-1,1))\n", "\n", "error = 0.01\n", "\n", @@ -218,14 +218,14 @@ "output_type": "stream", "text": [ "==== setting up ezkl ====\n", - "Time setup: 0.5770092010498047 seconds\n", + "Time setup: 0.5848329067230225 seconds\n", "=======================================\n", "==== Generating Witness ====\n", "witness boolean: 1.0\n", "witness result 1 : 3.25\n", "==== Generating Proof ====\n", - "proof: {'instances': [['cde936180fb7e379a578309232773e02b017d59f9001712b917a148b525d7b19', 'a38c8628cd223f38f854eade2722b8dd09b5797a0408398dd3d5160b6584e90b', '0100000000000000000000000000000000000000000000000000000000000000', '0d00000000000000000000000000000000000000000000000000000000000000']], 'proof': '0x09606478d0a9cdee960ce674400471165e5035f1c02037706840f1a45d0b012f2bd5a245aabe26ddf0d27dfa169b8852c2e7ce772cdf7006484314eb51af77b914fd1a03b69e1d94ef57310da85e47294727cffa619b46a3254f2ac537eb3f6d167d0a5e8859a968bbb88f8b8fd247ecd2c5e349f80a5e6c0795d55f0772a60614dc4f32e72e22d85d6fe698e2e4df3efbf84845f8d15b2c558b4b0b9c8e1e650b6fefc119c48085105965a4c77979ba226a4980ebb76df1aa84b661a33f6a9f09e5f4fb1e542d9b2887a0d6b5a35c173e3e2b5c5b19350033b717f0caf79db818c2bb337a505e25bba4c427170ecf55475de8c349710fcaab82c77ef4ed6bde1f34414f055322f9cf5ef5c499799de590baf09c47bc545d782e675ae14567da0bb9a4fad126e19556a48b4ae43bbf10e08765a5bf86965193a9b37823b2e97422c89015bf7f6bcdce32508656f93142d31a67bd9a0ea75df9e8d19ff6322810132dbd9b4f2a0be1c4bee8490aa9efe9f0f8f305a76e7201fcf4385095b396ff2648dca155ad347436df43308cc31f91d867c170f45fa5a9f851f38b61277d8c158a3eaa91d31014853ecbeda97cebfbb8662894370dc04ef3005c6fc6affbfa024dc6af56c0d8b7f8922f1850d947428bd0578f9906aec5f5d442caef77d59d303257b377a77bd0f643440602313991a32a503f4c85db90737397dbc0a019d10fe4230e71172bfe2a3b725207408145c670e6e29a32aa327c60db02e8764e701ed781350a153a3237a7ddcd154a084d2bf00c40be6e4bf3871a0624354ee5cc0ca54e557480c214bdd058a48c1d2ac12d2c93df75be3785fc50eb165ecffe6c2eec97ba103a40b52b8fe540b74403480cdcab88521ec11c1f814b104328feda0ca54e557480c214bdd058a48c1d2ac12d2c93df75be3785fc50eb165ecffe6c2eec97ba103a40b52b8fe540b74403480cdcab88521ec11c1f814b104328feda25b3c5fc4b869a8092ee62e4fbe6f18660a380c11d89ec58e9d1ff3317de72f32fbf89b974fe190b33b27dc419758e0404981c52094998a100a9e720ccb89f4e03cca3271f3a05a8fcdc0b6abebfd07d3839beb7233e98cde8080345a0aa05510f14f81c484c7d449399743c8a2415b9ae48041e59d642be6c12c677d70d789b1c3dc6e23bb31f9f0f81a4c72c93173ff9eba2707c7886b637b6706b29aebd0023732bc849c10502e1610272c7822f904df283f93e401c6c831c817d1a38ee142b3e18a112389334286244e80ef849effff98379530846a5ce5ebb4c2a5fe35118571e4e178df3dccf318f41c58c0eef0cf406bfd37148cf3361297945628c25161377416d8cbb451075147c682ef3ceb7dd50cb874f4d3cecd973e4434b60d512106651494e9a0f64c81b849c2dba84b44cd19fb74299d861c8ff68c2fbbcd515ae75f00b7ba59b2243f3444483670326f4a15a5264393c783013280dbe39c1089eeac3bf66e31878b721814f8ad87c64506b5094d9c07fdd786a6bcef403f01e146df52e8457bfb183fc77a8d516d098db6447b78f1005945055aca910407f28775ad0d22981ab9a10e9af15f99d537e4bc079a065ffd153462c367a30d67626d7aa2aca949917a82d6b938f67653e0ef4443d92b0e241d3898190c717984f1b29fe01adf77e3b6b8035f56ab3fd54224dbf50559434ef2280bf7e9b3c1a791e129a9e2e8c0caf715445865644be373c25c7b8811f5965dcdfb6345e8604de05100a99bdeb6dbfd2706c875be30551de1b1078020ecc54741c6d612cda6b96074f1b5999b930af960387703cacd12386438018e43a70b1c8db4ac4ee3d97970104de6627c658acec48a50d578f4adb87583dfe1b52739dc115f7c01a19d5242966e7996b4f3d5eb4d1d95f269e2210af5509203343dd1e682f1021c2fbdfed17d310fdd5d701611d28c200135fffe377db22be3d1f7e42ed63fab43d13c60f12d01d73af26240bb4e4f3097105cf7512cfca49ed2e193559b029a201da220a05df3d809d3a68bec125c3961e0e0072a0cf05729aa7a6f8f3c51d32768c079b230e3ab93f5764dc534e0fac3ca431528608030f2844d81d11466c385a07d2252559b0b3c1ae2569ea9523dd9f6630318e708976b100886524768987dfbcb2ea01fb1d8dd620f62fc90c9b97ca50be52ca7f1d15e12a82b70c0b869315db64fd25bb6b9afdc162c8e6076150ea7766be67db4d591400c8a464181ad766fe29cf0cd60a673a028b9ed52a75048eb8c9bc8be0a1691f6d336d520ba96c6105cd010d19786c1d09cc4f366cabfc822e0883d30f58a090c7fb6f809d87b2b2d7edb82a756d37c6c47a67d7e4b83062329aa25f2a4bdc973a9ee19ec9bf24eed8c7b42b64736345bfa306fc5d60002aff8d1fc17ac0d33f2c2ab7779810ed075aafd91ce0c1b4d7402786c415dd68f68cd511ad9242cdf38c6ab8be757dc3f1c877d82677bddd67a574b1ac0df1fa62ba595ac378e6757e7436e4329092440749206a2d0144c8e1a7f3118a878af6ec172e04fa1f89b1507675fead83de0970adb3c028cdd7bdfb353f69fe099e0bf29d65cc6b8f0ded034c7f67279b37c866a3b21103eb15abf6c5102c6d83d792ea96ac4c0a1376248da5e6ba03981ceacd76e83d175e34ea605f39ab30d82191d12d8498fc591d701f2da4ca26c99adf8680a23e08b01e9fae42c12e8c2e609d3ee7a730d7794ac10eb91da112e7bb2db4a2cc512138809d6a8b74503ce145fffaaece7a455bb72893de225c758555878e49cf302db77ee03938d765c8083f798fef04ce5fd677ac6353da29ed8a24fae49e823d07d734da9d905f4268d0fc8ad3f1f2dd1d788bf194fabec4ed5b95390f27333d0e6918d4779e7ef3b25a1b05fa4515ceae3c7d418a253450de63a886c022ce621d08b606df011b5363742baf1b2a850c58ef96614c8fb61ccb11693536c308780221a1dc1e68ecf5755711da491e3f2df1d62587e575af8a0727d384dad198fe2f3abeb95eb3a31dd1bcbf6e996ae86901eec4a83d4dd000ffa42095a1346abc042b2e9c4409424691dd4374bcc63a0bc3f34af257493ebebfcb925f047bf7a41f9874e8a473c3d204fb14039cba7972f8c73a230b9cf7c5a7a165ebbd1a51a40c21d4827c46c9cc8c427fd4713d3762562a1cd22c28d69f828d7ac9b6dfe9a724e39c0e7e66471e1f7f22101e3b7c8feba22596947b7f74f59849513f4bf2352150740ddcb1e5d3ad7be18881f17e2d7c66c8a1dccfb6560574f008ea28e7172f7c0c2f37e688a54118bf976b5a7e9d51be1aff20db4198ee6f8183c2bc863e115be5f93a1b4d432e4dd1c4960daae93e0cafd6e0c51b69337352cf68265ca00a7f8b00891c72c2ea2eba9245b2e6e0d09be46b43d1955c977173cc1d85cfcb0b595f7b8cc7eae84acd9ce9189163fa397a39cb48c03d65809e1cb31db316f422e224588f4fd87d30e9913e5323ccf5ef5c5f9e8d11fec9ed06d434feb2a5b80b7d0fc6cd5086b8581b4d6b6d3b6fe3e37475d4c160ee7a52ad1e787a8359492479243571d663c6385aefb3b93d68ad929ab69b3c117a065914ea9046e34e8e1156d90d7c9da48ab6c42a130b91fc6f739eeebd06b24fda7ef6d5fefcaa34650961cf1102b747932d3b5d86acd0764a6c28e664cbb74e079cebdfb96979abcb2688458f264bae47b89bafffc4f0ef23df861932cb3fbae33dd3d81dd3638c77066c4ef9ff037de4bd62fd8b2d1094cef89015ceb0ebc711a0db2a5f219f58b3192e7a2b4244f87bf1fcb0f80f7a48d4f602a877345d2e9e8a4339095925dc84115659f7d43eed8d2e8436acfdd97258efeb94f354538d3864fe2b5ff1942f1714f85165c33b38d5017f5bf5ffddaf66189540ddecc808eff1a8ff2ba7da857202779e5dff0116fb93d841534a97fbae2a2d7e12232f0ed2e1640c9723f130a304ed80de5d45c98fe9a6fe0565d03844a7a57e78f5957307f68c1c1453a77d000d72c9285b97a64c659d7b9564c24e4673155d418230e6e536003f317e33cf1e14ecc3e40b25e9301a3bd07c4b19db3082e9770b77e669ce0701a3033880f1f72761e96a174abb64a09f5fa54b9bbab2dba57004cc9dc4c92c9f396f4d10b34b283f175a35cd66ea002853bb61a74f53fcf2c3d71538ebb36c66ef3cbdffd2b5189bb1124d29217c40c4be359ee5584ac289b3e6c51ec3c32baefde034526f0f0bc99ac6f93b0e9c87249795ff9b08eac57ec12c2717b8486e8838a371c6bdab0b22b2e828212f12d75cf6045f31464cae619e4cb8ed9340e076467cf1d4ed1d08cc30aa085c270e809d305184eabaf5b43e3838f4bde2e0d128f8774bd57696000000000000000000000000000000000000000000000000000000000000000028a516673a95aa61e32625075a43b19c18decee185693da35444d976f4ed2a2e260458ebe4d755b26e7fe1177a4b2f62d601f8370ac7e670909c7465529d489e000000000000000000000000000000000000000000000000000000000000000016cf7d23851ce6719d1c5ccb6139ca10f2a829b64a8b431ede4a9ce360b37ef50603ab68d1d863e8e975527d32560bec96b8ca4335092457e12b1b1180cc65161f244ffd6afe0607ee69089cb9cb502eca603f5323fadf2d10a1851f8d92967500000000000000000000000000000000000000000000000000000000000000000c276310bdc3fff318e9893bb8352ebde2c915e459faa87ef45b0f5de9d2b2290ee60049b010535fb8c791251d76085fef6ea83fd30935bfd796fdeb1a2446dc000000000000000000000000000000000000000000000000000000000000000008786703d486445956e3ee571a4405a2f5b6512aa37a86bcba2d0e539181c8f800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000995e7627e397dc2aa09609c612b2f2c2e8bf5a6be3d599e65df511e4574789e25daac56f9957d571b06b08c1bbd19ca4530a4b914b35fc0027cd9e066f9f47e16d82e27afff4704e47c41f7ada5cd0a180ec72fa8a2936a1445459c7a7b46b2175fd11ac2893beb43662d13daa181d4c850ced1744c0e2237e68290bfbd2cdc0aa7a5e3bd15de8b4c042799e43696d731d053dfe6bd92a9334997feebc481c9227d4e39ec8a1ff5d59dadbd1a3337dd6b59a9e37a6e3f1a119c58bedf69c2c003cb96130e5313e6ac8936b619ddc92d54e81cc89ca84707cb5f80e733247b0a204996439a58d2dc4f5d3f90f1df3032e854836851f5c08609d576441afbdd1f00000000000000000000000000000000000000000000000000000000000000000a3ad199bf4bac6dc0f211d3636009648c1013e7d7539ff622e9f2451f91f34a07b483ae1b05826839ce3f336dd17c33255a89070a447f7a7cd07e2c116e617519e7e6ce18f7820bf7c7417161037e8149ff1c75cf3090dbc2ed05020dd8a4ad141160e8b3bf574ca06ec2e55d0c2d110b74c04abfd6bc14f0333bd8281701e00b56fff7f14dce36acc5f3a156cb38fa07c5059aa6866255d213bd630237ac51265ff5644c9dd491600a0713d7daed7c40a89a57d33a105482dfb6b236bdd61d29133e739f92e72f656b28245d9efbca33b2cbca789ae470fc857a52c7fa94c01e49a5c68d4b3e85a7f25fc0126637576714f3910feeff79154ae99a26c7d6d11c99b0e5304764fd82c68c2e06be16ce31002c1560749cfcda38906e0bd3765114a50c0f80c5ea06a2a1e8e06456fea9d4e8367100aabcb1b99bb8a908baa19203be6e7d9e5611ab62c699834c8645c850d3bbd79ea2ced33c6f926ce4b8a2a82d2f5ed715df6b227a6d494caac8b30981823f6a6198489cf73dab459eae14231904794958f558592131e2dc268b490605d434e090a1e22929a3915520ab96f42356b8d8fb19c22c2d328ace7d0a41bb78c593e54173b7dbd8b574eecaac09d00ae5922665ee93d988be9562962687893edd8b499de2e303412d407bd2984ea007f82b2c2f51cd107111663f28840f099f01ee0f9eb850d60ecddc46e367d289213c0ebc623b4c3f41c4031131b30164701efb1c05f66e42a6c179cf678c0b9e28ad0ce103613cf6270bc8dcbd0fed55ce03fa9721cb4ccc7ff57b40fde72cef27c95d44fd1909ab8b45a805e854dc1ab3edc7dfd21f105069d1b79410278b09012d48ad4b815ba8d9ece099278365dde50b426379afe599a4b14ba3de9a618611f520e04b62fa479648ddea1079f5dab70eba968b23e874f5dc7f1156a6d3e4153599d375baacb6fec6bac00c35c5ff876aabb8941c4d38d4bf953ee15a2696069947c23623704ae9cb7a753e21f3edee426cac2b307a93dd41c48d3dc55f72019696d04d3ed1fb6c938be8d81a681c032afa4a907d80aa2efd809b0af85a75181e34a526a943eae053f2106ea8a2b71aeeb33dbf970855532e3adeaaa5bba42e269a2cc4ed61d43ac2c1b90f974638ded1384db2ee2b2a934cf9f34c62911f1999add033b96c0b6b4e797dc934cf0c4b542e767476efa5cf471146af744f26181e34a526a943eae053f2106ea8a2b71aeeb33dbf970855532e3adeaaa5bba4128fc5b4f4e8dce5adf83a6fb2c0ec7f206999631cf60cbf41a2c653c836a8941977eaeba484f18988677f40eac6dea3395d94b5ac0d5dc922755216ff1faf061f8da4f6e212a896679dff729822c88c519d93e95f6112b3d06359546f257c9309c3de45dd67ed4d422c690a66de6913482a7afaba3461096770d1c48469a21501521f7b4b97e5d96f8ffc0aeb4fa0cd1ae067970f73d4a51437cecf52c21a330be492f7edd5bfd4a7b58bf0ba198384eb8233b0a164a1d0fb537b44d572a2d02c3d04ac17c26a5e7e32989399e0f99d9438cf220c37ab7578d497336a034727262f08e11f29aa9b8cc0872349a234c545817b0f09033d01c8ab17049d46b8e42d0da75ffd0fda2b67857ade216f6667a78c6037b53c2a4218d0bc2d82eb379d1d644e18928bfb9b4902eabb59afd21fbbcb37e91e846e893455e04ba90245d10af868be22ebab9f8f5977fba04dc80a1fb5aee140f465ab3c6e9b06fb7700d80dd1df24967e546da7f00d0548cca06068da58c3a23befbbf63ec1dd6106404b1136d0c6d5c6bc83f71a69e25bea34028659e35b70ccf41c5e081e5fe1f7089627491f9ffe47e20e93420445f84881b396028d2642ef51e98c17e319d14403501b363050961cd407736e37dbbbbb30575753daeb401c028a760d4f6be62826f201d2eb27f03901ff6d27f5d6d34177d14005d8ef30dae568eddaf60b1a37b79a039d6809964653b398e1cf0add8f6ea509a02fd542d119c1b0fe4b7c9c659b0120d7ffd70df7e8e3084eed99a50cef64a6f0483d7b5c37f6941aa40e9b097b922babc611a6503c2407584bcc74344c4063d17214a566f8263c23ccebf61858c1292e5035235ccd4a6f7ce9c3eb13f831ba42cb6074e1c60684ad8a60df13fb761dc90736671f7b9a658969a2a386ed7f6d847d1eef3ea0a57954e6d37712d8f8141fe08a23af2c3a10e36dfefe466b2a2d3ece038aa3aab9012d71454f2a830a', 'transcript_type': 'EVM'}\n", - "Time gen prf: 0.7872781753540039 seconds\n" + "proof: {'instances': [['cde936180fb7e379a578309232773e02b017d59f9001712b917a148b525d7b19', 'a38c8628cd223f38f854eade2722b8dd09b5797a0408398dd3d5160b6584e90b', '0100000000000000000000000000000000000000000000000000000000000000', '0d00000000000000000000000000000000000000000000000000000000000000']], 'proof': '0x14aab2d61c36f54c01b029ec94e4cdd5912cf88aec978f32911cca8dbe6b31ec25b16aa397465167f3e81d04ecd2d8eb6129cf799965f3aa1dc5168261594d161c632dca5bec85d38e77d4ef34a0cbf684870a38d6ae120c49a7aadd7e2822222d0179a3b39857b10ba05f43f8ba980b40ec1f5aa4b4da8f864f7494a8a691ff0c0b737fa648f9bfd292e52749a73dcf5984962b3e25805d0d615ad5bc8cab3c22e47d4bbf4096569fb4b9ebae431c7057026269f3d5b76f3511f9f8334726f922e745b87410b732d91e80339b44281530daad388d387340413f14ba243c090c070195ef9f1d2eab7b0362977f676cf13b54b05e6dc5aa8107194059e8857cde137e8f402cc113e89ad18363274dc6741bcd521702b9341e287ce56ee535b96f11b081ed1b39a83577de68c6e40121197d9cb5273947945fd959bf47eec64d970f8f65fab4b479300d039849483eaffa9e073bbccd5424ff2adbccb89a34d1fa0b3afeb0b6a14f5eaf6872b87e19d014a401d55c53bb20014e335b830d244cba167bac9a814342f3e6d4b298c7bf0c05f6c28caa7c8ab3aad6e7f68c26781ba5202123c996b2d0253ede283c589424f2178972dc0350363081fecc13c23026d41e34fafc98307e8c6d310ffd5994ae5e4a811f920b932e25bfb80eaa4132b98225883b00c2a7cfe629083ee8c43e42e8671d45669aef6aa0ba93c36caa6240f915a363c215788d3841f83a107af5882da31439218e89245d63cd60433ecd49bc0fdba58dd81e6bd3ee61650832921a5695a2266b980396b8e610fff9e6aa33ba0f2ce9c45b2ee99bb8f37f36b6c4c20fe4a0fbe965998e563f8f6d574365db5e2864f63d2b27c179d091964af8ddd3e8d51bea9df1cc5c85e5d3b65408de594902d57a0b3c5fb367a9aa0ef30f7714638efead76372b2c970e5d60f1b445d54a1c38a67bb23be3715713aefb0392d5faa5418a82135fbc9e307536e301fc34432c2ce2ddad8bb3e13055d151ad9835f0f87951b616a89bfba1d79b39585c93100817283cd61bbce32a6e91873119f58162c5699df19a09b42d30f239eb0ad9dc161377416d8cbb451075147c682ef3ceb7dd50cb874f4d3cecd973e4434b60d512106651494e9a0f64c81b849c2dba84b44cd19fb74299d861c8ff68c2fbbcd5161377416d8cbb451075147c682ef3ceb7dd50cb874f4d3cecd973e4434b60d512106651494e9a0f64c81b849c2dba84b44cd19fb74299d861c8ff68c2fbbcd528bd740e5be8e62edac39f2f12bdea192d4cb42c66518b4bea8720e0310f39c219c8636df935f1005c5e709ada7dbfe7bba421e2adaadf57d46351c7cf6c40ce0360ffe2eb20ba4789c56ca6552c928975811034623d748af8d5b52b8f08b2d11e71fa53b0af31e7ba9328f246d6311445fcf300cbd3d094cc283388363cf19005b17456d868ce91e941d1ce22eb8dafcc00fc4541e7421448184e0d551171df2e026ef5fecbf5b473f6f827db354bf52e78ea95339b6476658fc08ee0e857de098e217a29691aad1bee889c648c03d6ba051a8b1c76feda28c1ccdfa6b5978f2d6526aebcac323b826a326b0680e964aaa50d7dda850d98dc416f1232275c1f1a98d489f8b9b7234b7a89caf94acfa68ce4c4b1f1201aa6cde7ed4462fb3fb907abd3e67f14681326439e07550f6d084dfd69027f38af555d18aefeb39ae90a1b42aaf47d5088b75fe22dc5b0a9885600915d0894b9bdc31d0137787e781b62057b9b9ca392ab5999f44fb0858df870a4a0e81f1f0ddc35c6d55bc4cfdc306d08a99954be58f9b380859eed275b7c41f54d3b602d527672b545a6dc3ed7ec910d47fb351ffe1ea255dbc19591088ca87d3182530b148644cc11c55cb347c3081b34d2520fca8f75ce9022fca95d1aca8ddf535062b436a4c3790ca5f0fec6e413c5df394b404555da9f03c73b4bc67945958461d517886487551a15f765b0c42ec580e0b82380e449c05880617c5c6c9f36021d6a8b972c59db0007652a1f36305cc0a074602de85f46daa1ca11af2cc744a751babe38cda0cb3479c6d564622c1d02b8d15d8c8afaaaee0b31d72c56bb15d9590939fa42b15727c7e26a0087101b342241f5201d5e4286f55bbd698566cb6bb4c2e48cfa7fbe39defa3d70822a9dc0fbbb7d4bfb5de104106b0ba76cda3b9946134cdd96d5629d53b1361e3e057a74c80ae2611f691ec19037afab0a39b7c1bb34b6fc95eee0712352fb9033143ebf89ad6d2f7fcc7f94994d7aa20b28570392800f48d4c5bc1c3e75b8d6ab08482f2d8d3a5af47f8fd450a043fb8b5b2796f2af349cbb7c27cbb5d9702f691a300aa382b5b68223ff9c21d4ca0e08e201de32fa4ee89153b662c57f75c7610cf92bfb19d5632a8b0c73b340d5d1276435264622c09da499bf85ab1704361927f01fe6d5fc4bb193de1a27f029bcd573ef3ca9e895f2d64b034dbf04126c2600e7fc847006195cb617a04fa9975548fae43faa16fa7f30ec5bf456eb8fc6c91964858bdf1148db374615144aae40af424e640dd7ce53269afd287803634cf52e54c57d8300fdd22d57ad458d1542bfaaf0d8a6a36009c35de2379cb7e21d9c0e1616a6a4fea415c3c9e6e0a57c5a1e150931348d0b282d6219ca623f089d302f3460217d6a673b4815ddd65c5de2aeede84dd06afe2ceb3f5a9a084c85904d185e089aea63b5286a3042aa8bb29f895f1a8f7f6d0c4952f176cd7271e1122f2382d0091c71d63c2b6b03c794728bcb03d2fc6d023c187c05c379f904278c6916fc181b4e358515dd3be2922f5a2246014bd71a1d51d9e6470a3c8f0a36f8722feeff4e0239e0a0bfad6ab178fcd2557232bf66f0e9dbda5cbc9d5a887ae29f02b3575357350a7e726fce3f9256f5eddc37c2f3624635844431f3690b787828289e0c39651a29fa6c6cb25f215dfa75835e1056fa69ddc7cb540442138bd28f20574b874d68352125cd556ba3aa5fdba114cdac49b55ac3cea2f3eb4c24de8a299084e151908b4d5f4dab00522e863e6a55fe535b6323c14c625be4432130420ffe55819eaa55cbdf738b0e5b51dbc4d51752f2bc8576669150b51b911301be1309da8789f16e552608d8b98eb603b6b1569c8ce16391c9de48e63396c7b06922c86e98735b3b8ede4eba96c2700d0de3315f01ca6001948b6df1707fa6bfbf225a1376bda64647350790aebdadc6175ace1b7be51c20d766194be35e2effe9036cafb23fa98fc852adc46cbafd4778618d0e096bb68c2d9a667b51c2e6d6610e75023d3f855d8852d8c2e7f8d473381c9cd185f5071e8c7f1168cbee671f4317fa785ca5d2b166d2e65a609d16596abf0f12974f00115cb9dca42cd74fb3c706c19ba893a4bfa0fb3e7085116e68c9ea1bbd42d6e34fb0bcffb21064a63831135716c1a60d880430ce387ca879d5760a28d1b21b615b607453fd093325685d0fefad905011ef5f1113374f4fba3a4a7c8dde02a3900ce8d71fe83bd285abab21ba43725c1240a25597d4de14f2c4308923de9cace145249e1677fb1fd4f14d1b9dc3ee4390a2944e56222d7a18ee3b9a6e6848a53974ceb3dafd20d4ae36eb2331e1148f315b9bebeee8b38c307c511dca0759f9df3113539bc2833f2f1bed2c4507c5380c989e969f314e563c8be5c8c022ad05a0540b75dcf19ab11393ba21fe77b8b4a41d4aac0b7caa7fc022625c01cd1042423f10e8ac96ef99a1f6eb04bddb36014ae47d979c1b2654b7fd861d18b123219288107cfcd94cd69b333e1909a09ead8fb8d35affdcab51399db5e96761aabf466f0337bf6616e2ad00b5229fdef25e528c7a79df1879d8d0dd2825a9a520fe1a3d3bdc5555ea34c6dffc0a1580bbfe65c9a2d64ad2d6b713a01d9b521e11fac08f59887c2033ad44d0291d215d7b0ccf5ef41cdff1ca90343bc68dc181f97a6269773f266b97317c3683133d661d4d3f4a03f2e9f2ce876a182a68197a55b1605edc34a37f5ae73f6a280bd3fbb5bf9b5c8ffad933017a4ecc580b3df121cc4f273c0a657fcda3234a8009596ebf8daf3513c8f3f3d27e9ff48e427172b1e85e54412a20931e9d029dcd277d910e3893d3618854c16d055cc7f681668fc36c33f5b0e9492dd6d7500bb52652bdcd9ba9d840f601508d0ecc836bbb01580628370b23c2029a5584d8e0f205e50722d7ba32a18d8d001e0d5e1a9bbaf546c9479acd36a96b2f65f189dd2a24e9eafc14f5a82d29e5a1f91c0d173d8b8cb71de237c82305cf776d8bcc0d492d8b3d7505bbd91f329e2ac11efc26e56da36f7a7b6188254148c633e8701051099ec24d22c3b566237b76d9b400240c383ad23966c2191b70c0419d4b45035a00000000000000000000000000000000000000000000000000000000000000002f0563d8235050a1690131d8b0f2927fb3d6066bbadfb14a664d238a892927d82f41f85e7a3cc3bbb6d2b1539beb4ee887184ce08f974650f06ce35495dff93e00000000000000000000000000000000000000000000000000000000000000000e600106b66368c809223501dee54a09262d1cd292ec4b35e0b4f9cc47df71f12cc734d1ecb809c246a3a43dab4ebcac31214b38b54b9c6c75103ac3a160074722f2ac1b4b3ae5ce5b6f7391266b4c61465f634276cac9d21f52f982f892d12800000000000000000000000000000000000000000000000000000000000000001c7d18c8bf60ddb29b6c7f01913f938325cd08ad2ca7e7132347dcd3ffba199c214b2be9cc6a8a2857055e6e5b86d7156a5ca05acb13d526ab003893b17c4bb80000000000000000000000000000000000000000000000000000000000000000085b6e0c551ed985f00d539f1fdb3337cf92fd7f5a1d2b694464fe4d4accc957000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000006f916123028c8464d63b0f851e8309e95831320922141a226709f7cf4f519341eae94b3f046f4b5569830b6c6c6a85e8f6aa6f221ad812e207d9a07b2dbf164051c29f7ccc41b671bef3338518007999f2ef5e68c0bc112dafe82e210b410d108ee33b6a0a69a3c2c093f6c553706980c73c4582d7e03c1c9290dc46599818026c012067e41f83ddbf83a9b83a2a6d171c527e91bb4fc5c3a59bd8d626193b000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000029b221bef0c4d9c990965968bb00d9619ffbafce4397c2b7cec5186fd68db1e25141199d70392199cdc817e7361b03b6d15d17aa3d6192fe80cde85fdc3b25c07e93b23fb9f3604f922f489a4584520cd9d16d04b57e445c625833ea4a190370bd06f2336923877065e14c70977ad75b1450302781c03c824e139fa14f8408e0b4177cc8cf4802d244070d537514e1851f1abbd93d6cd1a44d2b69fcd7322641fc95036f123b29db2d3b890abb803cfe45a4e010eabfc3c9ee65db6c3282b041715cd4b44ab49c8db79eadcc53f67786d071873c44fe5893f79b3eefb45d84d217c2d4b3f1a8093ef3fea37018c6067bb4e6ca0be6b13f260b05ebadccd1c61247da1128e4f5f1f31418b75ec2cd04dbe6852abe5ba9db1cca093051f799afa168a51a80eb74e971f50932cb65b1dd7f358322b762bee6267864a6646a8539404130d89e3dffdc18d7cd6bde3eecba88a3467f4657c0f5118701926b9933dd7044d855b14de2fab7686642dd1a12f6df0d98221f7fc02d4ecb6f35170f44262207fb77a16f291521e5846ffd76f295374b34c40fd22948bfcb0cb1b71ca7f950bc218a4fd237e94e67a9b8747f61ff34c26b6424f656e85f0b593b9dde919a71068f986e0cbfb135ca722ae00f94c6ca988423ff2d983930a22be1608fb061d161cc277f50576140e04896f756ecffe4c64d02e4dd512f4f0dda0d9059c2f1f1599551b6f1517cf54d1e376f6fa00f4a26a2474cf82cba08a2677d146f3199a285ab900b756eb226440e83fcb9c6f6b80baeed69133bbcf669d66b00b8e080c0ec2a1c0dbb4c3e992cde0ef3ae7ef92fb54933e25fa11d3c2d0065c0e5991d427a6bbd269d4611cf9fe5afe81a76c5c8a655c98a765b450acf416eca739600a2aa4383452640c6f78bae62dd405b877275b6a6a7716906799a8ab4a78f0efb7113d21f694bae213ef796974d77688a7b29ce41027436cb459cbe8b564536dd600456dcff330e492aa1b97a7ae858aafcbc30a7d3b187d414b6b03d9c0c71e0f2359b341171b3c3fe3f7967c184c47a0d13ca11ad11d1966b13a0c1d02b578fd13e60353f7397e8eae754891b202070185c44d6bbcdd63f865c574ee3cd61c6206a37ec0d783e100177862b53e52960012ec31a10c6841a063f27a7cfa334d3429ca29468b2eac0503bbd81896351691bff3376ae13656cbac7c9a91da714598224b256b81044f448296efcbf1a64448775df7a39d9a6a4fa9e34c29681a64cb25712738a5f997d845edf516599b8958c635d3ae167a8441e27271d053b0df8e1e75da0ebcaf23c10e8cb364aadc84108f78086a705b7d64f18a22f5c85f32c7173d49d59b78f813f2996ce9bdae9fa1872737a6a1de645eb59380cb9974b26e14d9090855dab9b2bff89938a700553db9f52258e6d477e7d5bfb109c1e9ff7e305a239495071eeb0568fcbfe83088ebebd2a0804cd5b56658751180778f27400643a85dbb99b1a281bf92b1ce717da6fbde11cf5dbe18dea8fc90a7b0e13ae12a8ae9d54e0006abc2fb1da44caed9a9cc7b3fccd1d6ba1c63ffe6317b6c96c70e3d91533bbe74c0a36ac7d16cc03abda331b7860d9f63acd80ff79d15e368032862e4023a039869f4087eebb14a543ed785dd5ce8db40b8b7c822e9cc26def412066c9c39dfe1d18c7b0781ab2dced01efe6187656bae5f31d9373474150d590e3d91533bbe74c0a36ac7d16cc03abda331b7860d9f63acd80ff79d15e3680303ef289a66a1b72a319977498030f2f3504dabdb8fdc33ab212f49ac89c6b4ca2bca73ca8a0472d59b2e39d68f0b18e3c0832fd7d2b7321c8d6f4702118ac41312df383823509c7495efd925ca570a27052a6e2013891408bcea9cf00a756d7a042623680220fd717751b6290729eda29437f9d44822b99aec5c7a3224b904da2addeba7bcf5ffc90cd89b18711c8ca2829714e8082cec975fce6ee4e46f48e3244ff7ca04723f1607c151d01bc6bbda655ebab15d020c641fdc857390e2341225e702182ae00c15b3fae9a036a77f300d75bcb949349dcc33faa16045aa1fed19163d1f2b76b4a4cf94b89d630a44d306d16ba2f8ed56454ff9e0c4c197ba2e12c9739d47a136df172e58f3abf68331cf98ea974fd429685d131328bced646b0e4e88bdb668bf3890874c861a4e9dc9a0a7a001626a40b82739b29f82e202d8024c5008680e24f85a898e082b5a35941fc42a8540b02bdf4681b7c04e9aa598299bdbd3e1c882f3821e2e153573effd5589219fef1d2a527e6e8b5b0e204f132a0537dfbe26a9f411bd2141e26dcb9fe2d54024db032a6a8248e6b3b212d5f7', 'transcript_type': 'EVM'}\n", + "Time gen prf: 0.7657780647277832 seconds\n" ] } ], diff --git a/playground/README.md b/playground/README.md new file mode 100644 index 0000000..9711b3e --- /dev/null +++ b/playground/README.md @@ -0,0 +1 @@ +Nothing much useful here. Just a playground to test codes real quick. diff --git a/playground/example.onnx b/playground/example.onnx new file mode 100644 index 0000000000000000000000000000000000000000..6e01e1082f2e45c93a987a73d1abb9d75002c3d1 GIT binary patch literal 535 zcmd;J6Jjr@EXglQ&X8g?(gQ-Pf6QDNT&$US1*IiI{QAKKIhiH#`K2X5ZoC1yfFZho zkrW$5ixMkXrxrICOJYT4u>`{cMkXx*F4kg@c@B&qxPXzJ%Y_TW3PJtg!qU{#s#LhG zQXDWLC3dJB#N5PD}#a0MS65-2eap literal 0 HcmV?d00001 diff --git a/playground/playground.ipynb b/playground/playground.ipynb new file mode 100644 index 0000000..e69de29 diff --git a/playground.py b/playground/playground.py similarity index 100% rename from playground.py rename to playground/playground.py diff --git a/tests/test_computation.py b/tests/test_computation.py index 3871942..aa23693 100644 --- a/tests/test_computation.py +++ b/tests/test_computation.py @@ -39,7 +39,7 @@ def nested_computation(state: State, args: list[torch.Tensor]): out_8 = state.covariance(x, y) out_9 = state.correlation(y, z) out_10 = state.linear_regression(x, y) - slope, intercept = out_10[0][0][0], out_10[0][1][0] + slope, intercept = out_10[0][0], out_10[1][0] reshaped = torch.cat(( out_0.unsqueeze(0), out_1.unsqueeze(0), @@ -53,7 +53,7 @@ def nested_computation(state: State, args: list[torch.Tensor]): out_9.unsqueeze(0), slope.unsqueeze(0), intercept.unsqueeze(0), - )).reshape(1,-1,1) + )).reshape(-1,1) out_10 = state.mean(reshaped) return out_10 @@ -125,9 +125,9 @@ def test_nested_computation(tmp_path, column_0: torch.Tensor, column_1: torch.Te op_10 = ops[10] assert isinstance(op_10, Regression) out_10 = statistics.linear_regression(x.tolist(), y.tolist()) - assert op_10.result.shape == (1, 2, 1) - assert_result(op_10.result[0][0][0], out_10.slope) - assert_result(op_10.result[0][1][0], out_10.intercept) + assert op_10.result.shape == ( 2, 1) + assert_result(op_10.result[0][0], out_10.slope) + assert_result(op_10.result[1][0], out_10.intercept) op_11 = ops[11] assert isinstance(op_11, Mean) diff --git a/tests/test_ops.py b/tests/test_ops.py index 5a47390..e014068 100644 --- a/tests/test_ops.py +++ b/tests/test_ops.py @@ -51,10 +51,10 @@ def test_linear_regression(tmp_path, column_0: torch.Tensor, column_1: torch.Ten expected_res = statistics.linear_regression(column_0.tolist(), column_1.tolist()) columns = [column_0, column_1] regression = Regression.create(columns, error) - # shape = [1, 2, 1] + # shape = [2, 1] actual_res = regression.result - assert_result(expected_res.slope, actual_res[0][0][0]) - assert_result(expected_res.intercept, actual_res[0][1][0]) + assert_result(expected_res.slope, actual_res[0][0]) + assert_result(expected_res.intercept, actual_res[1][0]) class Model(IModel): def forward(self, *x: list[torch.Tensor]) -> tuple[IsResultPrecise, torch.Tensor]: return regression.ezkl(x), regression.result diff --git a/zkstats/computation.py b/zkstats/computation.py index 879ddbb..bd25ba2 100644 --- a/zkstats/computation.py +++ b/zkstats/computation.py @@ -196,7 +196,7 @@ def _call_op(self, x: list[torch.Tensor], op_type: Type[Operation]) -> Union[tor self.op_dict['Correlation']+=1 elif isinstance(op, Regression): result_array = [] - for ele in op.result.data[0]: + for ele in op.result.data: result_array.append(ele[0].item()) if 'Regression' not in self.op_dict: self.precal_witness['Regression_0'] = [result_array] @@ -204,6 +204,14 @@ def _call_op(self, x: list[torch.Tensor], op_type: Type[Operation]) -> Union[tor else: self.precal_witness['Regression_'+str(self.op_dict['Regression'])] = [result_array] self.op_dict['Regression']+=1 + # for ele in op.result.data[0]: + # result_array.append(ele[0].item()) + # if 'Regression' not in self.op_dict: + # self.precal_witness['Regression_0'] = [result_array] + # self.op_dict['Regression']=1 + # else: + # self.precal_witness['Regression_'+str(self.op_dict['Regression'])] = [result_array] + # self.op_dict['Regression']+=1 # for verifier else: # print('Verifier side create') @@ -252,13 +260,13 @@ def is_precise() -> IsResultPrecise: is_precise_aggregated = torch.logical_and(is_precise_aggregated, res) if self.isProver: json.dump(self.precal_witness, open(self.precal_witness_path, 'w')) - return is_precise_aggregated, op.result+(x[0]-x[0])[0][0][0] + return is_precise_aggregated, op.result+(x[0]-x[0])[0][0] elif current_op_index > len_ops - 1: # Sanity check that current op index does not exceed the length of ops raise Exception(f"current_op_index out of bound: {current_op_index=} > {len_ops=}") else: - return op.result+(x[0]-x[0])[0][0][0] + return op.result+(x[0]-x[0])[0][0] class IModel(nn.Module): @@ -302,7 +310,7 @@ def forward(self, *x: list[torch.Tensor]) -> tuple[IsResultPrecise, torch.Tensor # print('x sy: ') result = computation(state, x) if len(result) ==1: - return x[0][0][0][0]-x[0][0][0][0]+torch.tensor(1.0), result + return (x[0]-x[0])[0][0]+torch.tensor(1.0), result else: return result # print('state:: ', state.aggregate_witness_path) diff --git a/zkstats/core.py b/zkstats/core.py index 3007372..7cc2dc1 100644 --- a/zkstats/core.py +++ b/zkstats/core.py @@ -319,15 +319,15 @@ def _export_onnx(model: Type[IModel], data_tensor_array: list[torch.Tensor], mod # Flips the neural net into inference mode circuit.eval() input_names = [] - dynamic_axes = {} + # dynamic_axes = {} data_tensor_tuple = () for i in range(len(data_tensor_array)): data_tensor_tuple += (data_tensor_array[i],) input_index = "input"+str(i+1) input_names.append(input_index) - dynamic_axes[input_index] = {0 : 'batch_size'} - dynamic_axes["output"] = {0 : 'batch_size'} + # dynamic_axes[input_index] = {0 : 'batch_size'} + # dynamic_axes["output"] = {0 : 'batch_size'} # Export the model torch.onnx.export(circuit, # model being run @@ -338,7 +338,8 @@ def _export_onnx(model: Type[IModel], data_tensor_array: list[torch.Tensor], mod do_constant_folding=True, # whether to execute constant folding for optimization input_names = input_names, # the model's input names output_names = ['output'], # the model's output names - dynamic_axes=dynamic_axes) + # dynamic_axes=dynamic_axes + ) # mode is either "accuracy" or "resources" @@ -436,7 +437,7 @@ def _process_data( for col in col_array: data = data_onefile[col] data_tensor = torch.tensor(data, dtype = torch.float32) - data_tensor_array.append(torch.reshape(data_tensor, (1,-1,1))) + data_tensor_array.append(torch.reshape(data_tensor, (-1,1))) sel_data.append(data) # Serialize data into file: # sel_data comes from `data` diff --git a/zkstats/ops.py b/zkstats/ops.py index 1e11af4..cbdca2f 100644 --- a/zkstats/ops.py +++ b/zkstats/ops.py @@ -53,10 +53,10 @@ def ezkl(self, x: list[torch.Tensor]) -> IsResultPrecise: def to_1d(x: torch.Tensor) -> torch.Tensor: x_shape = x.size() - # Only allows 1d array or [1, len(x), 1] + # Only allows 1d array or [len(x), 1] if len(x_shape) == 1: return x - elif len(x_shape) == 3 and x_shape[0] == 1 and x_shape[2] == 1: + elif len(x_shape) == 2 and x_shape[1] == 1: return x.reshape(-1) else: raise Exception(f"Unsupported shape: {x_shape=}") @@ -97,7 +97,7 @@ def create(cls, x: list[torch.Tensor], error: float, precal_witness:Optional[di def ezkl(self, x: list[torch.Tensor]) -> IsResultPrecise: x = x[0] - old_size = x.size()[1] + old_size = x.size()[0] size = torch.sum(torch.where(x!=MagicNumber, 1.0, 0.0)) min_x = torch.min(x) x = torch.where(x==MagicNumber,min_x-1, x) @@ -141,7 +141,7 @@ def create(cls, x: list[torch.Tensor], error: float, precal_witness:Optional[di return cls(torch.tensor(precal_witness['GeometricMean_'+str(op_dict['GeometricMean'])][0]), error) def ezkl(self, x: list[torch.Tensor]) -> IsResultPrecise: - # Assume x is [1, n, 1] + # Assume x is [n, 1] x = x[0] size = torch.sum(torch.where(x!=MagicNumber, 1.0, 0.0)) x = torch.where(x==MagicNumber, 1.0, x) @@ -166,7 +166,7 @@ def create(cls, x: list[torch.Tensor], error: float, precal_witness:Optional[dic def ezkl(self, x: list[torch.Tensor]) -> IsResultPrecise: - # Assume x is [1, n, 1] + # Assume x is [n, 1] x = x[0] size = torch.sum(torch.where(x!=MagicNumber, 1.0, 0.0)) return torch.abs((self.result*torch.sum(torch.where(x==MagicNumber, 0.0, torch.div(1.0, x)))) - size)<=torch.abs(self.error*size) @@ -237,15 +237,15 @@ def create(cls, x: list[torch.Tensor], error: float, precal_witness:Optional[di def ezkl(self, x: list[torch.Tensor]) -> IsResultPrecise: - # Assume x is [1, n, 1] + # Assume x is [n, 1] x = x[0] min_x = torch.min(x) - old_size = x.size()[1] + old_size = x.size()[0] x = torch.where(x==MagicNumber, min_x-1, x) count_equal = torch.sum(torch.where(x==self.result, 1.0, 0.0)) count_check = 0 - for ele in x[0]: + for ele in x: bool1 = torch.sum(torch.where(x==ele[0], 1.0, 0.0))<=count_equal bool2 = ele[0]==min_x-1 count_check += torch.logical_or(bool1, bool2) @@ -538,16 +538,20 @@ def __init__(self, xs: list[torch.Tensor], y: torch.Tensor, error: float, preca x_one = stacked_x(x_1ds) result_1d = np.matmul(np.matmul(np.linalg.inv(np.matmul(x_one.transpose(), x_one)), x_one.transpose()), y_1d) - result = torch.tensor(result_1d, dtype = torch.float32).reshape(1, -1, 1) - # print('result: ', result) + # result = torch.tensor(result_1d, dtype = torch.float32).reshape(1, -1, 1) + result = torch.tensor(result_1d, dtype = torch.float32).reshape(-1,1) super().__init__(result, error) + # print('result regression: ', result) else: if op_dict is None: - result = torch.tensor(precal_witness['Regression_0']).reshape(1,-1,1) + # result = torch.tensor(precal_witness['Regression_0']).reshape(1,-1,1) + result = torch.tensor(precal_witness['Regression_0']).reshape(-1,1) elif 'Regression' not in op_dict: - result = torch.tensor(precal_witness['Regression_0']).reshape(1,-1,1) + # result = torch.tensor(precal_witness['Regression_0']).reshape(1,-1,1) + result = torch.tensor(precal_witness['Regression_0']).reshape(-1,1) else: - result = torch.tensor(precal_witness['Regression_'+str(op_dict['Regression'])]).reshape(1,-1,1) + # result = torch.tensor(precal_witness['Regression_'+str(op_dict['Regression'])]).reshape(1,-1,1) + result = torch.tensor(precal_witness['Regression_'+str(op_dict['Regression'])]).reshape(-1,1) # for ele in precal_witness['Regression']: # precal_witness_arr.append(torch.tensor(ele)) @@ -565,9 +569,9 @@ def ezkl(self, args: list[torch.Tensor]) -> IsResultPrecise: # infer y from the last parameter y = args[-1] y = torch.where(y==MagicNumber,0.0, y) - x_one = torch.cat((*args[:-1], torch.ones_like(args[0])), dim=2) - x_one = torch.where((x_one[:,:,0] ==MagicNumber).unsqueeze(-1), torch.tensor([0.0]*x_one.size()[2]), x_one) - x_t = torch.transpose(x_one, 1, 2) + x_one = torch.cat((*args[:-1], torch.ones_like(args[0])), dim = 1) + x_one = torch.where((x_one[:,0] ==MagicNumber).unsqueeze(-1), torch.tensor([0.0]*x_one.size()[1]), x_one) + x_t = torch.transpose(x_one, 0, 1) left = x_t @ x_one @ self.result - x_t @ y right = self.error*x_t @ y