This document describes the step-by-step instructions for reproducing PyTorch ResNet18 MixedPrecision results with Intel® Neural Compressor.
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.
Download ImageNet Raw image to dir: /path/to/imagenet. The dir includes below folder:
ls /path/to/imagenet
train val
Note: All torchvision model names can be passed as long as they are included in
torchvision.models
, below are some examples.
bash run_autotune.sh --input_model=resnet18 --dataset_location=/path/to/imagenet
# 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