Skip to content

Latest commit

 

History

History

mixed_precision

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 

Step-by-Step

This document describes the step-by-step instructions for reproducing PyTorch ResNet18 MixedPrecision results with Intel® Neural Compressor.

Prerequisite

1. Environment

PyTorch 1.8 or higher version is needed with pytorch_fx backend.

cd examples/3.x_api/pytorch/image_recognition/torchvision_models/mixed_precision/resnet18
pip install -r requirements.txt

Note: Validated PyTorch Version.

2. Prepare Dataset

Download ImageNet Raw image to dir: /path/to/imagenet. The dir includes below folder:

ls /path/to/imagenet
train  val

Run

Note: All torchvision model names can be passed as long as they are included in torchvision.models, below are some examples.

MixedPrecision

bash run_autotune.sh --input_model=resnet18 --dataset_location=/path/to/imagenet

Benchmark

# run optimized performance
bash run_benchmark.sh --input_model=resnet18 --dataset_location=/path/to/imagenet --mode=performance --batch_size=20 --optimized=true --iters=500

# run optimized accuracy
bash run_benchmark.sh --input_model=resnet18 --dataset_location=/path/to/imagenet --mode=accuracy --batch_size=1 --optimized=true