onnxruntime/docs/get-started/training-pytorch.md
Baiju Meswani 25125b5b91
Training related changes to the onnxruntime website (#15900)
Changes include:

- Added a new page for `On-Device Training` overview:
[Preview](https://baijumeswani.github.io/onnxruntime/docs/get-started/on-device-training.html)
- Added a new section for `On-Device Training` installation:
[Preview](https://baijumeswani.github.io/onnxruntime/docs/install/#install-for-on-device-training)
- Added a new section for `On-Device Training` build from source:
[Preview](https://baijumeswani.github.io/onnxruntime/docs/build/training.html#build-for-on-device-training)
- Updated Large Model Training overview, installation, build pages to
reflect what is currently accurate.

Website preview: https://baijumeswani.github.io/onnxruntime/


Pending website work:
- Update links for released packages for training.
- Add tutorial for on-device training
- Add links to the blog posts that detail on device training.
2023-05-17 14:45:52 -07:00

38 lines
No EOL
1.5 KiB
Markdown
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

---
title: Large Model Training
parent: Get Started
nav_order: 12
---
# Get started with Large Model Training with ORTModule
{: .no_toc }
`ONNX Runtime Training`'s `ORTModule` offers a high performance training engine for models defined using the `PyTorch` frontend. `ORTModule` is designed to accelerate the training of large models without needing to change the model definition and with just a single line of code change (the `ORTModule` wrap) to the entire training script.
Using the ORTModule class wrapper, ONNX Runtime runs the forward and backward pass of the training script using an optimized automatically-exported ONNX computation graph.
## ORT Training Example
In this example we will go over how to use ORT for Training a model with PyTorch.
```sh
# Installs the torch_ort and onnxruntime-training Python packages
pip install torch-ort
# Configures onnxruntime-training to work with user's PyTorch installation
python -m torch_ort.configure
```
**Note**: This installs the default version of the `torch-ort` and `onnxruntime-training` packages that are mapped to specific versions of the CUDA libraries. Refer to the install options in [onnxruntime.ai](https://onnxruntime.ai).
- Add ORTModule in the `train.py`
```diff
+ from torch_ort import ORTModule
.
.
.
- model = build_model() # Users PyTorch model
+ model = ORTModule(build_model())
```
## Samples
[ONNX Runtime Training Examples](https://github.com/microsoft/onnxruntime-training-examples)