From 34f904b6a1c4e14c3ec9e1e0a251cb9b165d7ef4 Mon Sep 17 00:00:00 2001 From: hsharif3 <hsharif3@illinois.edu> Date: Wed, 3 Feb 2021 15:36:20 -0600 Subject: [PATCH] Update Keras README.md --- hpvm/projects/keras/README.md | 34 +++++++++++++++++++++++++--------- 1 file changed, 25 insertions(+), 9 deletions(-) diff --git a/hpvm/projects/keras/README.md b/hpvm/projects/keras/README.md index 7852e1fca7..e092715a07 100644 --- a/hpvm/projects/keras/README.md +++ b/hpvm/projects/keras/README.md @@ -42,6 +42,8 @@ python setup.py install Benchmarks under `./src/` +**NOTE:** Activate conda environment (above) before running benchmarks + List of benchmarks and the expected accuracies: | Benchmark | Accuracy | @@ -57,12 +59,11 @@ List of benchmarks and the expected accuracies: | VGG16-CIFAR100 | 66.50 | | VGG16-ImageNet | 69.46 | -Activate conda environment (above) before running benchmarks ### Synopsis ``` -python src/${BENCH_NAME}.py [hpvm_reload|keras_reload] [frontend|keras_dump] +python src/${BENCH_NAME}.py [hpvm_reload|keras_reload] [frontend] ``` @@ -72,30 +73,45 @@ python src/${BENCH_NAME}.py [hpvm_reload|keras_reload] [frontend|keras_dump] `keras_reload`: Reloads weights in Keras `.h5` file format -`frontend`: Invokes the HPVM frontend and dumps weights in directory specified in constructor - -`keras_dump`: Dumps keras .h5 format model weights in directory specified in constructor +`frontend`: Invokes the HPVM frontend and dumps weights (in HPVM `.bin` format) in directory specified ### Building New Benchmarks All benchmarks inherit from the commom parent `Benchmark` class. -Each benchmark overrides virtual functions for building the model, training, inference, +Each benchmark overrides virtual functions for building the model, training, and data preprocessing. `def buildModel(self)`: -returns a keras model +Constructs and returns a keras model `def data_preprocess(self)`: -returns X_train, y_train, X_test, y_test, X_tuner, and y_tuner data — in that order; this data will be directly used later for training and inference +returns X_train, y_train, X_test, y_test, X_tuner, and y_tuner data (in that order): +These are described here: + +* `X_train:` Training data (fp32) in NCHW format +* `y_train:` Training labels (int32) + +* `X_test:` Testing/Evaluation data in NCHW format +* `y_test:` Testing/Evaluation labels + +* `X_tuner:` Data to be used for autotuning +* `y_tuner:` Labels corresponding to tuning data + `def trainModel(self, model, X_train, y_train, X_test, y_test)`: -returns a trained keras model +Trains the Keras model constructed in `buildModel` and is expected to return the +trained keras model - training parameters should be tuned here. +## Limitations +* We mosty support convolutional neural networks - RNNs/LSTMS are not supported +* We currently only support models in NCHW format (NHWC is not supported) +* Softmax operator should be the last operation in the CNN pipeline +* Softmax operation must be a separate operator (not specified as activation to another type of Keras operator) -- GitLab