Optimize a ResNet50* Bfloat16 Model Package with PyTorch*

Published: 12/09/2020

Customer Reviews

☆☆☆☆☆ (0)  Rate this solution


Download Command

wget https://storage.googleapis.com/intel-optimized-tensorflow/models/v2_3_0/pytorch-resnet50-bfloat16-inference.tar.gz

Description

This document has instructions for running ResNet50* bfloat16 inference using Intel® Extension for PyTorch*.

Datasets

The ImageNet validation dataset is used when testing accuracy. The inference scripts use synthetic data, so no dataset is needed.

Download and extract the ImageNet2012 dataset from http://www.image-net.org/, then move validation images to labeled subfolders, using the valprep.sh shell script

The accuracy script looks for a folder named val, so after running the data prep script, your folder structure should look something like this:

imagenet
└── val
    ├── ILSVRC2012_img_val.tar
    ├── n01440764
    │   ├── ILSVRC2012_val_00000293.JPEG
    │   ├── ILSVRC2012_val_00002138.JPEG
    │   ├── ILSVRC2012_val_00003014.JPEG
    │   ├── ILSVRC2012_val_00006697.JPEG
    │   └── ...
    └── ...

The folder that contains the val directory should be set as the DATASET_DIR when running accuracy (for example: export DATASET_DIR=/home//imagenet).

Quick Start Scripts

Script name Description
bf16_online_inference.sh Runs online inference using synthetic data (batch_size=1).
bf16_batch_inference.sh Runs batch inference using synthetic data (batch_size=128).
bf16_accuracy.sh Measures the model accuracy (batch_size=128).

Bare Metal

To run on bare metal, the following prerequisites must be installed in your environment:

Download and untar the model package and then run a quick start script.

# Optional: to run accuracy script
export DATASET_DIR=<path to the preprocessed imagenet dataset>

# Download and extract the model package
wget https://storage.googleapis.com/intel-optimized-tensorflow/models/v2_3_0/pytorch-resnet50-bfloat16-inference.tar.gz
tar -xzf pytorch-resnet50-bfloat16-inference.tar.gz
cd pytorch-resnet50-bfloat16-inference

bash quickstart/<script name>.sh

 


Documentation and Sources

Get Started
Main GitHub*
Readme
Release Notes
Get Started Guide

Code Sources
Report Issue

 


License Agreement

LEGAL NOTICE: By accessing, downloading or using this software and any required dependent software (the “Software Package”), you agree to the terms and conditions of the software license agreements for the Software Package, which may also include notices, disclaimers, or license terms for third party software included with the Software Package. Please refer to the license file for additional details.


Related Containers and Solutions

ResNet50* BFloat16 Inference TensorFlow* Container

View All Containers and Solutions 🡢

 

Product and Performance Information

1

Performance varies by use, configuration and other factors. Learn more at www.Intel.com/PerformanceIndex.