Running Swin Transformer Inference on Intel® Data Center GPU Flex Series using Intel® Extension for PyTorch*
This document has instructions for running Swin Transformer inference using Intel® Extension for PyTorch on Intel® Flex Series GPU.
Item | Detail |
---|---|
Host machine | Intel® Data Center GPU Flex Series 170 |
Drivers | GPU-compatible drivers need to be installed: Download Driver |
Software | Docker* |
Script name | Description |
---|---|
run_model.sh |
Runs Swin Transformer FP16 inference on Flex series 170 |
Note
The script is validated for FP16
precision on Flex Series GPU.
Refer to instructions here to download ImageNet dataset. Set DATASET_DIR
to point to the dataset directory.
docker pull intel/image-recognition:pytorch-flex-gpu-swin-transformer-inference
The Swin Transformer inference container includes scripts, model and libraries needed to run FP16 inference. To run the quickstart script using this container, you'll need to set the environment variable and provide volume mounts for the ImageNet dataset. You will need to provide an output directory where log files will be written.
#Optional
export PRECISION=FP16
export NUM_ITERATIONS=<provide number of iterations,otherwise (default: 500)>
export BATCH_SIZE=<provide batch size, otherwise (default: 512)>
#Required
export DATASET_DIR=<path to the imagenet dataset>
export OUTPUT_DIR=<path to output directory>
export PLATFORM=Flex
export MULTI_TILE=False
SCRIPT=run_model.sh
IMAGE_NAME=intel/image-recognition:pytorch-flex-gpu-swin-transformer-inference
DOCKER_ARGS="--rm -it"
docker run \
--ipc=host \
--device=/dev/dri \
--env BATCH_SIZE=${BATCH_SIZE} \
--env NUM_ITERATIONS=${NUM_ITERATIONS} \
--env PRECISION=${PRECISION} \
--env PLATFORM=${PLATFORM} \
--env MULTI_TILE=${MULTI_TILE} \
--env OUTPUT_DIR=${OUTPUT_DIR} \
--env DATASET_DIR=${DATASET_DIR} \
--env http_proxy=${http_proxy} \
--env https_proxy=${https_proxy} \
--env no_proxy=${no_proxy} \
--volume ${OUTPUT_DIR}:${OUTPUT_DIR} \
--volume ${DATASET_DIR}:${DATASET_DIR} \
${DOCKER_ARGS} \
${IMAGE_NAME} \
/bin/bash $SCRIPT
Support for Intel® Extension for PyTorch* is found via the Intel® AI Analytics Toolkit. Additionally, the Intel® Extension for PyTorch* team tracks both bugs and enhancement requests using GitHub issues. Before submitting a suggestion or bug report, please search the GitHub issues to see if your issue has already been reported.
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.