Skip to main content

Intel® Extension for PyTorch*

Reason this release was yanked:

for security.

Project description

Intel® Extension for PyTorch*

Intel® Extension for PyTorch* extends PyTorch* with up-to-date features optimizations for an extra performance boost on Intel hardware. Optimizations take advantage of AVX-512 Vector Neural Network Instructions (AVX512 VNNI) and Intel® Advanced Matrix Extensions (Intel® AMX) on Intel CPUs as well as Intel Xe Matrix Extensions (XMX) AI engines on Intel discrete GPUs. Moreover, through PyTorch* xpu device, Intel® Extension for PyTorch* provides easy GPU acceleration for Intel discrete GPUs with PyTorch*.

Intel® Extension for PyTorch* provides optimizations for both eager mode and graph mode, however, compared to eager mode, graph mode in PyTorch* normally yields better performance from optimization techniques, such as operation fusion. Intel® Extension for PyTorch* amplifies them with more comprehensive graph optimizations. Therefore we recommend you to take advantage of Intel® Extension for PyTorch* with TorchScript whenever your workload supports it. You could choose to run with torch.jit.trace() function or torch.jit.script() function, but based on our evaluation, torch.jit.trace() supports more workloads so we recommend you to use torch.jit.trace() as your first choice.

The extension can be loaded as a Python module for Python programs or linked as a C++ library for C++ programs. In Python scripts users can enable it dynamically by importing intel_extension_for_pytorch.

  • Check CPU tutorial for detailed information of Intel® Extension for PyTorch* for Intel® CPUs. Source code is available at the master branch.
  • Check GPU tutorial for detailed information of Intel® Extension for PyTorch* for Intel® GPUs. Source code is available at the xpu-master branch.

Installation

CPU version

You can use either of the following 2 commands to install Intel® Extension for PyTorch* CPU version.

python -m pip install intel_extension_for_pytorch
python -m pip install intel_extension_for_pytorch -f https://developer.intel.com/ipex-whl-stable-cpu

Note: Intel® Extension for PyTorch* has PyTorch version requirement. Please check more detailed information via the URL below.

More installation methods can be found at CPU Installation Guide

GPU version

You can install Intel® Extension for PyTorch* for GPU via command below.

python -m pip install torch==1.13.0a0 -f https://developer.intel.com/ipex-whl-stable-xpu
python -m pip install intel_extension_for_pytorch==1.13.10+xpu -f https://developer.intel.com/ipex-whl-stable-xpu

Note: The patched PyTorch 1.13.0a0 is required to work with Intel® Extension for PyTorch* on Intel® graphics card for now.

More installation methods can be found at GPU Installation Guide

Getting Started

Minor code changes are required for users to get start with Intel® Extension for PyTorch*. Both PyTorch imperative mode and TorchScript mode are supported. You just need to import Intel® Extension for PyTorch* package and apply its optimize function against the model object. If it is a training workload, the optimize function also needs to be applied against the optimizer object.

The following code snippet shows an inference code with FP32 data type. More examples on CPU, including training and C++ examples, are available at CPU Example page. More examples on GPU are available at GPU Example page.

Inference on CPU

import torch
import torchvision.models as models

model = models.resnet50(pretrained=True)
model.eval()
data = torch.rand(1, 3, 224, 224)

import intel_extension_for_pytorch as ipex
model = ipex.optimize(model)

with torch.no_grad():
  model(data)

Inference on GPU

import torch
import torchvision.models as models

model = models.resnet50(pretrained=True)
model.eval()
data = torch.rand(1, 3, 224, 224)

import intel_extension_for_pytorch as ipex
model = model.to('xpu')
data = data.to('xpu')
model = ipex.optimize(model)

with torch.no_grad():
  model(data)

Model Zoo

Use cases that had already been optimized by Intel engineers are available at Model Zoo for Intel® Architecture. A bunch of PyTorch use cases for benchmarking are also available on the Github page. You can get performance benefits out-of-box by simply running scipts in the Model Zoo.

License

Apache License, Version 2.0. As found in LICENSE file.

Security

See Intel's Security Center for information on how to report a potential security issue or vulnerability.

See also: Security Policy

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

File details

Details for the file intel_extension_for_pytorch-2.0.0-cp311-cp311-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for intel_extension_for_pytorch-2.0.0-cp311-cp311-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 990874320b42225db08af1ff848e9f70a4807e616bf9f85cd9613c6a28432b17
MD5 f99bcc719f474ff315e0ee4906fa9d64
BLAKE2b-256 bf5caad0e3cab0ca9e6c96441adaaa2d31c73a994b07cdb020fa9dfb3ec0f3d5

See more details on using hashes here.

File details

Details for the file intel_extension_for_pytorch-2.0.0-cp310-cp310-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for intel_extension_for_pytorch-2.0.0-cp310-cp310-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 7b630c29d7b3132596019ae74cfce8a955bfff3068234030d24e56fc354c4412
MD5 8bd9b757d55ee17bf9bc9195492deed6
BLAKE2b-256 c3ba72ae71b3167a020337d3c6c9c8d855c651ba4efddac620eb340dcb75eb04

See more details on using hashes here.

File details

Details for the file intel_extension_for_pytorch-2.0.0-cp39-cp39-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for intel_extension_for_pytorch-2.0.0-cp39-cp39-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 9314d78cc40e5e194e90fcd4f1ce40be68a8e05d8dd3f927b7cc8208879b9acf
MD5 d1f209ee1f9f77226f32dd228f368fc9
BLAKE2b-256 52c777d76d6aa2db06b5ee9ad4a6614afc6a4192c4e8d52ee18fccdb90ccf668

See more details on using hashes here.

File details

Details for the file intel_extension_for_pytorch-2.0.0-cp38-cp38-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for intel_extension_for_pytorch-2.0.0-cp38-cp38-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 d9e680ed8a6aba6a93fcac37568bece6bc8d489d847bc771c74446f8709bd8ea
MD5 e7f665a7c5976771a1a281472987f3c1
BLAKE2b-256 6546dff409036742e4cf62868676914fb53d119d8e3c32ff5a8a1220f778df14

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page