Skip to content

Commit

Permalink
Prepere for IMZ v2.0.0 release
Browse files Browse the repository at this point in the history
  • Loading branch information
ashahba committed Oct 20, 2020
2 parents 2712566 + 6e63fa3 commit 299738e
Show file tree
Hide file tree
Showing 480 changed files with 39,749 additions and 277 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,4 @@
test_data/
download_glue_data.py
data/
output/
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

This repository contains **links to pre-trained models, sample scripts, best practices, and step-by-step tutorials** for many popular open-source machine learning models optimized by Intel to run on Intel® Xeon® Scalable processors.

Model packages and containers for running the Model Zoo's workloads can be found at the [Intel® oneContainer Portal](https://software.intel.com/containers).

## Purpose of the Model Zoo

- Demonstrate the AI workloads and deep learning models Intel has optimized and validated to run on Intel hardware
Expand Down
12 changes: 12 additions & 0 deletions SECURITY.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# Security Policy

## Report a Vulnerability

Please report security issues or vulnerabilities to the [Intel® Security Center].

For more information on how Intel® works to resolve security issues, see
[Vulnerability Handling Guidelines].

[Intel® Security Center]:https://www.intel.com/security

[Vulnerability Handling Guidelines]:https://www.intel.com/content/www/us/en/security-center/vulnerability-handling-guidelines.html
5 changes: 5 additions & 0 deletions benchmarks/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,20 +23,25 @@ dependencies to be installed:
| Image Recognition | TensorFlow | [ResNet 50](https://arxiv.org/pdf/1512.03385.pdf) | Inference | [Int8](image_recognition/tensorflow/resnet50/README.md#int8-inference-instructions) [FP32](image_recognition/tensorflow/resnet50/README.md#fp32-inference-instructions)|
| Image Recognition | TensorFlow | [ResNet 50v1.5](https://github.com/tensorflow/models/tree/master/official/resnet) | Inference | [Int8](image_recognition/tensorflow/resnet50v1_5/README.md#int8-inference-instructions) [FP32](image_recognition/tensorflow/resnet50v1_5/README.md#fp32-inference-instructions) [BFloat16**](image_recognition/tensorflow/resnet50v1_5/README.md#bfloat16-inference-instructions)|
| Image Recognition | TensorFlow | [ResNet 50v1.5](https://github.com/tensorflow/models/tree/master/official/resnet) | Training | [FP32](image_recognition/tensorflow/resnet50v1_5/README.md#fp32-training-instructions) [BFloat16**](image_recognition/tensorflow/resnet50v1_5/README.md#bfloat16-training-instructions)|
| Image Segmentation | TensorFlow | [UNet](https://arxiv.org/pdf/1505.04597.pdf) | Inference | [FP32](image_segmentation/tensorflow/unet/README.md#fp32-inference-instructions) |
| Image Segmentation | TensorFlow | [MaskRCNN](https://arxiv.org/abs/1703.06870) | Inference | [FP32](image_segmentation/tensorflow/maskrcnn/README.md#fp32-training-instructions) |
| Language Modeling | TensorFlow | [BERT](https://arxiv.org/pdf/1810.04805.pdf) | Inference | [FP32](language_modeling/tensorflow/bert_large/README.md#fp32-inference-instructions) [BFloat16**](language_modeling/tensorflow/bert_large/README.md#bfloat16-inference-instructions) |
| Language Modeling | TensorFlow | [BERT](https://arxiv.org/pdf/1810.04805.pdf) | Training | [FP32](language_modeling/tensorflow/bert_large/README.md#fp32-training-instructions) [BFloat16**](language_modeling/tensorflow/bert_large/README.md#bfloat16-training-instructions) |
| Language Translation | TensorFlow | [BERT](https://arxiv.org/pdf/1810.04805.pdf) | Inference | [FP32](language_translation/tensorflow/bert/README.md#fp32-inference-instructions) |
| Language Translation | TensorFlow | [GNMT*](https://arxiv.org/pdf/1609.08144.pdf) | Inference | [FP32](language_translation/tensorflow/mlperf_gnmt/README.md#fp32-inference-instructions) |
| Language Translation | TensorFlow | [Transformer_LT_Official ](https://arxiv.org/pdf/1706.03762.pdf)| Inference | [FP32](language_translation/tensorflow/transformer_lt_official/README.md#fp32-inference-instructions) |
| Language Translation | TensorFlow | [Transformer_LT_mlperf ](https://arxiv.org/pdf/1706.03762.pdf)| Training | [FP32](language_translation/tensorflow/transformer_mlperf/README.md#fp32-training-instructions) [BFloat16**](language_translation/tensorflow/transformer_mlperf/README.md#bfloat16-training-instructions) |
| Object Detection | TensorFlow | [Faster R-CNN](https://arxiv.org/pdf/1506.01497.pdf) | Inference | [Int8](object_detection/tensorflow/faster_rcnn/README.md#int8-inference-instructions) [FP32](object_detection/tensorflow/faster_rcnn/README.md#fp32-inference-instructions) |
| Object Detection | TensorFlow | [R-FCN](https://arxiv.org/pdf/1605.06409.pdf) | Inference | [Int8](object_detection/tensorflow/rfcn/README.md#int8-inference-instructions) [FP32](object_detection/tensorflow/rfcn/README.md#fp32-inference-instructions) |
| Object Detection | TensorFlow | [SSD-MobileNet*](https://arxiv.org/pdf/1704.04861.pdf) | Inference | [Int8](object_detection/tensorflow/ssd-mobilenet/README.md#int8-inference-instructions) [FP32](object_detection/tensorflow/ssd-mobilenet/README.md#fp32-inference-instructions) |
| Object Detection | TensorFlow | [SSD-ResNet34*](https://arxiv.org/pdf/1512.02325.pdf) | Inference | [Int8](object_detection/tensorflow/ssd-resnet34/README.md#int8-inference-instructions) [FP32](object_detection/tensorflow/ssd-resnet34/README.md#fp32-inference-instructions) |
| Object Detection | TensorFlow | [SSD-ResNet34](https://arxiv.org/pdf/1512.02325.pdf) | Training | [FP32](object_detection/tensorflow/ssd-resnet34/README.md#fp32-training-instructions) [BFloat16**](object_detection/tensorflow/ssd-resnet34/README.md#bf16-training-instructions) |
| Recommendation | TensorFlow | [NCF](https://arxiv.org/pdf/1708.05031.pdf) | Inference | [FP32](recommendation/tensorflow/ncf/README.md#fp32-inference-instructions) |
| Recommendation | TensorFlow | [Wide & Deep Large Dataset](https://arxiv.org/pdf/1606.07792.pdf) | Inference | [Int8](recommendation/tensorflow/wide_deep_large_ds/README.md#int8-inference-instructions) [FP32](recommendation/tensorflow/wide_deep_large_ds/README.md#fp32-inference-instructions) |
| Recommendation | TensorFlow | [Wide & Deep Large Dataset](https://arxiv.org/pdf/1606.07792.pdf) | Training | [FP32](recommendation/tensorflow/wide_deep_large_ds/README.md#fp32-training-instructions) |
| Recommendation | TensorFlow | [Wide & Deep](https://arxiv.org/pdf/1606.07792.pdf) | Inference | [FP32](recommendation/tensorflow/wide_deep/README.md#fp32-inference-instructions) |
| Reinforcement | TensorFlow | [MiniGo](https://arxiv.org/abs/1712.01815.pdf) | Training | [FP32](reinforcement/tensorflow/minigo/README.md#fp32-training-instructions)|
| Text-to-Speech | TensorFlow | [WaveNet](https://arxiv.org/pdf/1609.03499.pdf) | Inference | [FP32](text_to_speech/tensorflow/wavenet/README.md#fp32-inference-instructions) |

## TensorFlow Serving Use Cases

Expand Down
106 changes: 82 additions & 24 deletions benchmarks/common/tensorflow/start.sh
Original file line number Diff line number Diff line change
Expand Up @@ -90,8 +90,8 @@ if [[ ${NOINSTALL} != "True" ]]; then
export HOROVOD_WITHOUT_PYTORCH=1
export HOROVOD_WITHOUT_MXNET=1
export HOROVOD_WITH_TENSORFLOW=1
# lock horovod==0.19.1 release commit/version
pip install --no-cache-dir horovod==0.19.1
# lock horovod==0.20.0 release commit/version
pip install --no-cache-dir horovod==0.20.0
fi
fi

Expand Down Expand Up @@ -500,6 +500,51 @@ function densenet169() {
fi
}

# Faster R-CNN (ResNet50) model
function faster_rcnn() {
export PYTHONPATH=$PYTHONPATH:${MOUNT_EXTERNAL_MODELS_SOURCE}/research:${MOUNT_EXTERNAL_MODELS_SOURCE}/research/slim
original_dir=$(pwd)

if [ ${NOINSTALL} != "True" ]; then
# install dependencies
pip install -r "${MOUNT_BENCHMARK}/object_detection/tensorflow/faster_rcnn/requirements.txt"
cd "${MOUNT_EXTERNAL_MODELS_SOURCE}/research"
# install protoc v3.3.0, if necessary, then compile protoc files
install_protoc "https://github.com/google/protobuf/releases/download/v3.3.0/protoc-3.3.0-linux-x86_64.zip"

# Install git so that we can apply the patch
apt-get update && apt-get install -y git
fi

# Apply the patch to the tensorflow/models repo with fixes for the accuracy
# script and for running with python 3
cd ${MOUNT_EXTERNAL_MODELS_SOURCE}
git apply ${MOUNT_INTELAI_MODELS_SOURCE}/${MODE}/${PRECISION}/faster_rcnn.patch

if [ ${PRECISION} == "fp32" ]; then
if [ -n "${config_file}" ]; then
CMD="${CMD} --config_file=${config_file}"
fi

if [[ -z "${config_file}" ]] && [ ${BENCHMARK_ONLY} == "True" ]; then
echo "Fast R-CNN requires -- config_file arg to be defined"
exit 1
fi

elif [ ${PRECISION} == "int8" ]; then
number_of_steps_arg=""
if [ -n "${number_of_steps}" ] && [ ${BENCHMARK_ONLY} == "True" ]; then
CMD="${CMD} --number-of-steps=${number_of_steps}"
fi
else
echo "PRECISION=${PRECISION} is not supported for ${MODEL_NAME}"
exit 1
fi
cd $original_dir
PYTHONPATH=${PYTHONPATH} CMD=${CMD} run_model
}


# inceptionv4 model
function inceptionv4() {
# For accuracy, dataset location is required
Expand Down Expand Up @@ -644,6 +689,23 @@ function minigo() {
fi
else
echo "MODE=${MODE} PRECISION=${PRECISION} is not supported for ${MODEL_NAME}"
exit 1
fi
}
# Mask R-CNN model
function maskrcnn() {
if [ ${PRECISION} == "fp32" ]; then
original_dir=$(pwd)

if [ ${NOINSTALL} != "True" ]; then
# install dependencies
pip3 install -r ${MOUNT_BENCHMARK}/image_segmentation/tensorflow/maskrcnn/inference/fp32/requirements.txt
fi
export PYTHONPATH=${PYTHONPATH}:${MOUNT_EXTERNAL_MODELS_SOURCE}:${MOUNT_EXTERNAL_MODELS_SOURCE}/mrcnn
CMD="${CMD} --data-location=${DATASET_LOCATION}"
PYTHONPATH=${PYTHONPATH} CMD=${CMD} run_model
else
echo "PRECISION=${PRECISION} is not supported for ${MODEL_NAME}"
exit 1
fi
}
Expand Down Expand Up @@ -692,30 +754,16 @@ function mtcc() {

# NCF model
function ncf() {
if [[ -n "${clean}" ]]; then
CMD="${CMD} --clean"
fi

# NCF supports different datasets including ml-1m and ml-20m.
if [[ -n "${dataset}" && ${dataset} != "" ]]; then
CMD="${CMD} --dataset=${dataset}"
fi

if [[ -n "${te}" && ${te} != "" ]]; then
CMD="${CMD} -te=${te}"
fi

if [ ${PRECISION} == "fp32" -o ${PRECISION} == "bfloat16" ]; then
# For ncf, if dataset location is empty, script downloads dataset at given location.
if [ ${PRECISION} == "fp32" ]; then
# For nfc, if dataset location is empty, script downloads dataset at given location.
if [ ! -d "${DATASET_LOCATION}" ]; then
mkdir -p ./dataset
CMD="${CMD} --data-location=./dataset"
mkdir -p /dataset
fi

export PYTHONPATH=${PYTHONPATH}:${MOUNT_EXTERNAL_MODELS_SOURCE}

if [ ${NOINSTALL} != "True" ]; then
pip install -r ${MOUNT_EXTERNAL_MODELS_SOURCE}/official/requirements.txt
pip install -r ${MOUNT_BENCHMARK}/recommendation/tensorflow/ncf/inference/requirements.txt
fi

PYTHONPATH=${PYTHONPATH} CMD=${CMD} run_model
Expand Down Expand Up @@ -999,8 +1047,12 @@ function ssd_vgg16() {
# UNet model
function unet() {
if [ ${PRECISION} == "fp32" ]; then
if [[ ${NOINSTALL} != "True" ]]; then
pip install -r "${MOUNT_BENCHMARK}/${USE_CASE}/${FRAMEWORK}/${MODEL_NAME}/requirements.txt"
fi

if [[ -z "${checkpoint_name}" ]]; then
echo "wavenet requires -- checkpoint_name arg to be defined"
echo "UNet requires -- checkpoint_name arg to be defined"
exit 1
fi
if [ ${ACCURACY_ONLY} == "True" ]; then
Expand Down Expand Up @@ -1116,7 +1168,7 @@ function wavenet() {
export PYTHONPATH=${PYTHONPATH}:${MOUNT_EXTERNAL_MODELS_SOURCE}

if [ ${NOINSTALL} != "True" ]; then
pip install -r ${MOUNT_EXTERNAL_MODELS_SOURCE}/requirements.txt
pip install librosa==0.5
fi

CMD="${CMD} --checkpoint_name=${checkpoint_name} \
Expand Down Expand Up @@ -1177,7 +1229,7 @@ function wide_deep_large_ds() {
TCMALLOC_LIB="libtcmalloc.so.4"
LIBTCMALLOC="$(ldconfig -p | grep $TCMALLOC_LIB | tr ' ' '\n' | grep /)"

if [[ -z "${LIBTCMALLOC}" ]]; then
if [[ -z $LIBTCMALLOC ]] && [[ $NOINSTALL != True ]]; then
echo "libtcmalloc.so.4 not found, trying to install"
apt-get update
apt-get install google-perftools --fix-missing -y
Expand All @@ -1196,7 +1248,7 @@ function wide_deep_large_ds() {
exit 1
fi
if [ ${MODE} == "training" ]; then
if [ ${steps} != None ]; then
if [[ ! -z $steps ]]; then
CMD="${CMD} --steps=${steps}"
fi
if [ ${PRECISION} == "fp32" ]; then
Expand Down Expand Up @@ -1256,12 +1308,16 @@ elif [ ${MODEL_NAME} == "faster_rcnn" ]; then
faster_rcnn
elif [ ${MODEL_NAME} == "mlperf_gnmt" ]; then
mlperf_gnmt
elif [ ${MODEL_NAME} == "ncf" ]; then
ncf
elif [ ${MODEL_NAME} == "inceptionv3" ]; then
resnet101_inceptionv3
elif [ ${MODEL_NAME} == "inceptionv4" ]; then
inceptionv4
elif [ ${MODEL_NAME} == "minigo" ]; then
minigo
elif [ ${MODEL_NAME} == "maskrcnn" ]; then
maskrcnn
elif [ ${MODEL_NAME} == "mobilenet_v1" ]; then
mobilenet_v1
elif [ ${MODEL_NAME} == "resnet101" ]; then
Expand All @@ -1280,6 +1336,8 @@ elif [ ${MODEL_NAME} == "transformer_lt_official" ]; then
transformer_lt_official
elif [ ${MODEL_NAME} == "transformer_mlperf" ]; then
transformer_mlperf
elif [ ${MODEL_NAME} == "unet" ]; then
unet
elif [ ${MODEL_NAME} == "wavenet" ]; then
wavenet
elif [ ${MODEL_NAME} == "wide_deep" ]; then
Expand Down
14 changes: 7 additions & 7 deletions benchmarks/common/tensorflow_serving/start.sh
Original file line number Diff line number Diff line change
Expand Up @@ -161,13 +161,13 @@ function resnet50v1_5(){

function ssd_mobilenet(){
# Install protofbuf and other requirement

pip install Cython \
contextlib2 \
pillow \
lxml \
absl-py \
tf_slim
pip install \
Cython \
absl-py \
contextlib2 \
lxml \
pillow>=7.1.0 \
tf_slim

cd ${WORKSPACE}
rm -rf tensorflow-models
Expand Down
25 changes: 4 additions & 21 deletions benchmarks/image_recognition/tensorflow/densenet169/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,34 +10,17 @@ following modes/precisions:

This step is required only for running accuracy, for running the model for performance we do not need to provide dataset.

Register and download the ImageNet dataset. Once you have the raw ImageNet dataset downloaded, we need to convert
it to the TFRecord format. The TensorFlow models repo provides
[scripts and instructions](https://github.com/tensorflow/models/tree/master/research/slim#an-automated-script-for-processing-imagenet-data)
to download, process and convert the ImageNet dataset to the TF records format. After converting data, you should have a directory
with the sharded dataset something like below, we only need `validation-*` files, discard `train-*` files:
```
$ ll /home/myuser/datasets/ImageNet_TFRecords
-rw-r--r--. 1 user 143009929 Jun 20 14:53 train-00000-of-01024
-rw-r--r--. 1 user 144699468 Jun 20 14:53 train-00001-of-01024
-rw-r--r--. 1 user 138428833 Jun 20 14:53 train-00002-of-01024
...
-rw-r--r--. 1 user 143137777 Jun 20 15:08 train-01022-of-01024
-rw-r--r--. 1 user 143315487 Jun 20 15:08 train-01023-of-01024
-rw-r--r--. 1 user 52223858 Jun 20 15:08 validation-00000-of-00128
-rw-r--r--. 1 user 51019711 Jun 20 15:08 validation-00001-of-00128
-rw-r--r--. 1 user 51520046 Jun 20 15:08 validation-00002-of-00128
...
-rw-r--r--. 1 user 52508270 Jun 20 15:09 validation-00126-of-00128
-rw-r--r--. 1 user 55292089 Jun 20 15:09 validation-00127-of-00128
```
Download and preprocess the ImageNet dataset using the [instructions here](/datasets/imagenet/README.md).
After running the conversion script you should have a directory with the
ImageNet dataset in the TF records format.

2. Download the pretrained model:
```
$ wget https://storage.googleapis.com/intel-optimized-tensorflow/models/v1_8/densenet169_fp32_pretrained_model.pb
```

3. Clone the [intelai/models](https://github.com/intelai/models) repo
and then run the model scripts for either online or batch inference or accuracy. For --dataset-location in accuracy run, please use the ImageNet validation data path from step 1.
and then run the model scripts for either online or batch inference or accuracy. For --data-location in accuracy run, please use the ImageNet validation data path from step 1.
Each model run has user configurable arguments separated from regular arguments by '--' at the end of the command.
Unless configured, these arguments will run with default values. Below are the example codes for each use case:

Expand Down
40 changes: 8 additions & 32 deletions benchmarks/image_recognition/tensorflow/inceptionv3/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,33 +41,9 @@ $ wget https://storage.googleapis.com/intel-optimized-tensorflow/models/v1_8/inc
4. If you would like to run Inception V3 inference with real data or test for
accuracy, you will need the ImageNet dataset.

Register and download the
[ImageNet dataset](http://image-net.org/download-images).

Once you have the raw ImageNet dataset downloaded, we need to convert
it to the TFRecord format. This is done using the
[build_imagenet_data.py](https://github.com/tensorflow/models/blob/master/research/inception/inception/data/build_imagenet_data.py)
script. There are instructions in the header of the script explaining
its usage.

After the script has completed, you should have a directory with the
sharded dataset something like:

```
$ ll /home/<user>/datasets/ImageNet_TFRecords
-rw-r--r--. 1 user 143009929 Jun 20 14:53 train-00000-of-01024
-rw-r--r--. 1 user 144699468 Jun 20 14:53 train-00001-of-01024
-rw-r--r--. 1 user 138428833 Jun 20 14:53 train-00002-of-01024
...
-rw-r--r--. 1 user 143137777 Jun 20 15:08 train-01022-of-01024
-rw-r--r--. 1 user 143315487 Jun 20 15:08 train-01023-of-01024
-rw-r--r--. 1 user 52223858 Jun 20 15:08 validation-00000-of-00128
-rw-r--r--. 1 user 51019711 Jun 20 15:08 validation-00001-of-00128
-rw-r--r--. 1 user 51520046 Jun 20 15:08 validation-00002-of-00128
...
-rw-r--r--. 1 user 52508270 Jun 20 15:09 validation-00126-of-00128
-rw-r--r--. 1 user 55292089 Jun 20 15:09 validation-00127-of-00128
```
Download and preprocess the ImageNet dataset using the [instructions here](/datasets/imagenet/README.md).
After running the conversion script you should have a directory with the
ImageNet dataset in the TF records format.

5. Next, navigate to the `benchmarks` directory in your local clone of
the [intelai/models](https://github.com/IntelAI/models) repo from step 1.
Expand Down Expand Up @@ -230,11 +206,11 @@ $ wget https://storage.googleapis.com/intel-optimized-tensorflow/models/v1_8/inc
```

3. If you would like to run Inception V3 FP32 inference and test for
accuracy, you will need the ImageNet dataset. Running for online
and batch inference do not require the ImageNet dataset. Instructions for
downloading the dataset and converting it to the TF Records format can
be found in the TensorFlow documentation
[here](https://github.com/tensorflow/models/tree/master/research/slim#an-automated-script-for-processing-imagenet-data).
accuracy, you will need the ImageNet dataset.

Download and preprocess the ImageNet dataset using the [instructions here](/datasets/imagenet/README.md).
After running the conversion script you should have a directory with the
ImageNet dataset in the TF records format.

4. Navigate to the `benchmarks` directory in your local clone of
the [intelai/models](https://github.com/IntelAI/models) repo from step 1.
Expand Down
Loading

0 comments on commit 299738e

Please sign in to comment.