uiuc-kang-lab / zkml

SysX
Apache License 2.0
15 stars 2 forks source link

Unable to Compile the Circuit #3

Open geralt-tian opened 1 month ago

geralt-tian commented 1 month ago

Hi, we encountered an issue when generating the proof. We have converted the resnet50 model types to TFLite. However, after processing about 10 layers, the program crashed with “NotEnoughRowsAvailable” error. Here are detailed commands we used:

# We first convert msgpack file with a large enough estimated k value, e.g. k = 23
python python/update_msgpack.py --model_input data/cifar10/converted_model.msgpack --config_input examples/efficlite/config.msgpack --k 23

# Compile the commitment to circuit, proof generation and verification
RUST_BACKTRACE=full ./target/release/time_circuit data/cifar10/converted_model.msgpack data/cifar10/example_inp.msgpack kzg

The same issue occurred when we tried to compile mobilenet. As GPT-2 requires only k=23 for rows, we assume k=23 is enough for resnet50 and mobilenet. So what could be wrong?

Thank you for reading the issue. Looking forward to your reply! 831a3dc03442570138b61bcfad8252a

Vimalakirti commented 1 month ago

Thanks for opening this issue.

I'm not sure how you got the converted model, so please allow me to provide more detailed guidelines.

Please run 1) cargo bench, 2) python python/summarize_bench.py, and 3) bash find_optimal.sh. (You can comment line 43-53 in find_optimal.sh out to speed up this process) After you find the optimal msgpack, use ./target/release/time_circuit to get the proving time.

Btw, if you remove the final (and only) softmax in resnet50 (which will not affect the max value of the result), then the best k and num_cols should be 19 and 15.