This release is a pre-release and may not be stable for production use.
Accelerate PyTorch models with ONNX Runtime
ONNX Runtime for PyTorch accelerates PyTorch model training using ONNX Runtime.
It is available via the torch-ort python package.
This repository contains the source code for the package as well as instructions for running the package and samples demonstrating how to do so.
Pre-requisites
You need a machine with at least one NVIDIA or AMD GPU to run ONNX Runtime for PyTorch.
You can install and run torch-ort in your local environment, or with Docker.
Run in a Python environment
Default dependencies
By default, torch-ort depends on PyTorch 1.8.1, ONNX Runtime 1.8 and CUDA 10.2.
-
Install CUDA 10.2
-
Install CuDNN 7.6
-
Install torch-ort and dependencies
pip install ninjapip install torch-ort
Explicitly install for NVIDIA CUDA 10.2
-
Install CUDA 10.2
-
Install CuDNN 7.6
-
Install torch-ort and dependencies
pip install ninjapip install torch==1.8.1pip install --pre onnxruntime-training -f https://onnxruntimepackages.z14.web.core.windows.net/onnxruntime_nightly_cu102.htmlpip install torch-ort
Explicitly install for NVIDIA CUDA 11.1
-
Install CUDA 11.1
-
Install CuDNN 8.0
-
Install torch-ort and dependencies
pip install ninjapip install torch==1.8.1pip install --pre onnxruntime-training -f https://onnxruntimepackages.z14.web.core.windows.net/onnxruntime_nightly_cu111.htmlpip install torch-ort
Explicitly install for AMD ROCm 4.1
-
Install ROCm 4.1 base package (instructions)
-
Install ROCm 4.1 libraries (instructions)
-
Install ROCm 4.1 RCCL (instructions)
-
Install torch-ort and dependencies
pip install ninjapip install --pre torch -f https://download.pytorch.org/whl/nightly/rocm4.1/torch_nightly.htmlpip install --pre onnxruntime-training -f https://onnxruntimepackages.z14.web.core.windows.net/onnxruntime_nightly_rocm41.htmlpip install torch-ort
Run using Docker
The docker directory contains dockerfiles for the NVIDIA CUDA 11.1 configuration.
-
Build the docker image
docker build -f Dockerfile.ort-cu111-cudnn8-devel-ubuntu18.04 -t ort.cu111 . -
Run the docker container using the image you have just built
docker run -it --gpus all --name my-experiments ort.cu111:latest /bin/bash
Test your installation
- Clone this repo
git clone git@github.com:pytorch/ort.git
- Install extra dependencies
pip install wget pandas sklearn transformers
- Run the training script
python ./ort/tests/bert_for_sequence_classification.py
Add ONNX Runtime for PyTorch to your PyTorch training script
from torch_ort import ORTModule
model = ORTModule(model)
# PyTorch training script follows
License
This project has an MIT license, as found in the LICENSE file.
Metadata
Release files for torch-ort 0.0.10.dev20210517
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| torch_ort-0.0.10.dev20210517-py3-none-any.whl | Python 3 | none | any | Details for torch_ort-0.0.10.dev20210517-py3-none-any.whl |
Release files / torch_ort-0.0.10.dev20210517-py3-none-any.whl
| Download URL | torch_ort-0.0.10.dev20210517-py3-none-any.whl |
|---|---|
| Size | 3.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
1c601bf12c17a51a5bc6017c676e8a1d2eac496d4e4c773b8b33ca88783eb104
|
|
BLAKE2b-256 checksum How to use checksums |
be509497bcd460c489468e8e1dc36449ad6908bf655ee98df8a0c1ac7c0ffc3f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.4.1 importlib_metadata/4.0.1 pkginfo/1.7.0 requests/2.22.0 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.8.5
|
Security for torch-ort 0.0.10.dev20210517
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.