Skip to content
Snippets Groups Projects
Commit 98843ac2 authored by Hashim Sharif's avatar Hashim Sharif
Browse files

Merging

parents 20677b4f 64fa8211
No related branches found
No related tags found
No related merge requests found
......@@ -25,7 +25,7 @@ conda activate keras_python36
At the root of this project (`/projects/keras/`) install the Keras frontend pip package as:
```
pip install -e ./
pip3 install -e ./
```
**NOTE:** If you are using the conda environment, activate it prior to this step.
......
# Keras Benchmarks
# Keras Frontend
Install Keras Frontend after moving to directory `/hpvm/hpvm/projects/keras`
## Requirements
* python == 3.6.x
* pip >= 18
If your system uses a different Python version, we recommend using the conda environment `keras_python36.yml`. Install this using:
```
conda env create -f keras_python36.yml --name keras_python36
```
Activate the conda environment before installing the pip package (below) using:
```
conda activate keras_python36
```
**NOTE:** This step must be performed each time (for each shell process) the frontend is to be used.
## Installing the Keras Frontend Package
Instructions for Installing the Keras Frontend are [here](https://gitlab.engr.illinois.edu/llvm/hpvm/-/blob/approx_hpvm_reorg_keras/hpvm/projects/keras/README.md)
At the root of this project (`/projects/keras/`) install the Keras frontend pip package as:
```
pip3 install -e ./
```
**NOTE:** If you are using the conda environment, activate it prior to this step.
## Suppported Operations
List of supported operations and limitations detailed in https://gitlab.engr.illinois.edu/llvm/hpvm/-/blob/approx_hpvm_reorg_keras/hpvm/projects/keras/docs/Support.md
# Keras Benchmarks
Run the Keras benchmarks under `hpvm/hpvm/test/dnn_benchmarks/keras`
## Download CNN Model Files
The weight (model) and data files to use with the CNN benchmarks are hosted on Git LFS and need to separately downloaded. This can be done using:
Prior to running the benchmarks, ensure you download the CNN model data (inputs and weights) if not done in automatic build script.
```
git lfs fetch
git lfs checkout
wget https://databank.illinois.edu/datafiles/o3izd/download -O model_params.tar.gz
tar -xf model_params.tar.gz
```
**NOTE:** Data donwload is necesary before running benchmarks
Move extracted `model_params` directory to `/test/dnn_benchmarks/model_params` (Benchmarks expect data at this location)
## Running Benchmaks
......@@ -23,22 +62,22 @@ List of benchmarks and the expected accuracies:
| Benchmark | Accuracy |
| ----------- | ----------- |
| AlexNet-CIFAR10 | 79.28 |
| AlexNet2-CIFAR10 | 84.98 |
| AlexNet-ImageNet | 56.30 |
| LeNet-MNIST | 98.70 |
| MobileNet-CIFAR10 | 84.42 |
| ResNet18-CIFAR10 | 89.56 |
| ResNet50-ImageNet | 75.10 |
| VGG16-CIFAR10 | 89.96 |
| VGG16-CIFAR100 | 66.50 |
| VGG16-ImageNet | 69.46 |
| alexnet.py | 79.28 |
| alexnet2.py | 84.98 |
| alexnet_imagenet.py | 56.30 |
| lenet.py | 98.70 |
| mobilenet_cifar10.py | 84.42 |
| resnet18_cifar10.py | 89.56 |
| resnet50_imagenet.py | 75.10 |
| vgg16_cifar10.py | 89.96 |
| vgg16_cifar100.py | 66.50 |
| vgg16_imagenet.py | 69.46 |
### Synopsis
```
python ${BENCH_NAME}.py [hpvm_reload|keras_reload] [frontend] [compile]
python3 ${BENCH_NAME}.py [hpvm_reload|keras_reload] [frontend] [compile]
```
......@@ -111,6 +150,32 @@ These are described here:
Trains the Keras model constructed in `buildModel` and is expected to return the
trained keras model - training parameters should be tuned here.
### Directly using Keras Frontend API
Alternate to extending the `Benchmark` class, users may directly invoke the Keras Frontend API. This can be done as:
```python
from keras_frontend.approxhpvm_translator import translate_to_approxhpvm
# Construct and train your Keras Model (or load pre-trained weights)
translate_to_approxhpvm(model, data_dir, src_dir, test_data, test_labels, tune_data, tune_labels, batch_size, num_classes)
```
## Running HPVM Binary
Run the `HPVM_binary` generated under the directory specified by `src_dir` (described above). Usage:
```
./HPVM_binary -t {test|tune} -c ${config_file_path}
```
`test|tune`: Runs with either tune (autotuning data) or test set (for evaluation)
`config_file_path`: Path to an HPVM tensor configuration file (includes approximation settings)
## Automated Tests
......@@ -121,9 +186,6 @@ python test_benchmarks.py
```
## Suppported Operations
List of supported operations and limitations detailed in https://gitlab.engr.illinois.edu/llvm/hpvm/-/blob/approx_hpvm_reorg_keras/hpvm/projects/keras/docs/Support.md
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment