-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cannot replicate extraction to MLCert #8
Comments
Using
It was initially rather unclear to me that the output of
|
Extracting a Coq model for EMNIST, with 10.000 nodes in the hidden layer, does not seem to be practical. Extraction ran for two days, and memory usage went up to 42GB, before I cancelled it. If you have had the same experience, @ejgallego has offered to help you optimise the generated Coq code, and has offered some suggestions:
I'm guessing that extraction might not be your priority, however, as the networks imported to Coq can already be run using the TensorFlow architecture, and extracting the verified code to Haskell may not offer any additional benefits. |
Thanks for your help, Wen! It would certainly be interesting to do the port to native vectors and floats (Coq 8.11), as suggested by @ejgallego. We're not actively working on MLCert at the moment, however, so I can't promise this will be done soon (or at all). |
Hi folks, indeed I believe it should possible to improve the efficiency of extraction quite a bit; just ping us or open an issue at https://github.com/coq/coq/issues and we'll be happy to try to help. |
I'm currently trying to replicate the extraction from an EMNIST network to MLCert. This is as far as I've gotten trying to get the code in NNCert to work, patching things up as I go:
Install Miniconda
conda create --name NNCert python=3.5
conda activate NNCert
pip install tensorflow==1.6.1
Download EMNIST
Patch
MLCert/NNCert/tf/extract_emnist.py
:emnist_load_data()
toemnist_load_data(<path/to/emnist>)
<path/to/emnist>/emnist
python extract_emnist.py
(fromMLCert/NNCert/tf
)Patch
MLCert/NNCert/tf/dataset_params.py
:make_dataset
:Patch
MLCert/NNCert/tf/pca.py
:_, _, _, _, _, load_data = ..
to_, load_data = ..
python pca.py
(fromMLCert/NNCert/tf
)Rename generated files
<path/to/emnist>/emnist/{train,test,validation}_reduced.pkl
to<path/to/emnist>/emnist/{train,test,validation}_pca.pkl
Patch
MLCert/NNCert/tf/Makefile
:train.py
tomain.py
eval.py
tomain.py
Patch
MLCert/NNCert/tf/main.py
:hidden_sizes = map(..)
tohidden_sizes = list(map(..))
make
(fromMLCert/NNCert/tf
)😭😭😭
The text was updated successfully, but these errors were encountered: