You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/source/quicktour.mdx
-36Lines changed: 0 additions & 36 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -129,42 +129,6 @@ To train transformers on Habana's Gaudi processors, 🤗 Optimum provides a `Gau
129
129
130
130
You can find more examples in the [documentation](https://huggingface.co/docs/optimum/habana/quickstart) and in the [examples](https://github.com/huggingface/optimum-habana/tree/main/examples).
131
131
132
-
133
-
#### ONNX Runtime
134
-
135
-
To train transformers with ONNX Runtime's acceleration features, 🤗 Optimum provides a `ORTTrainer` that is very similar to the 🤗 Transformers [Trainer](https://huggingface.co/docs/transformers/main_classes/trainer). Here is a simple example:
136
-
137
-
```diff
138
-
- from transformers import Trainer, TrainingArguments
139
-
+ from optimum.onnxruntime import ORTTrainer, ORTTrainingArguments
140
-
141
-
# Download a pretrained model from the Hub
142
-
model = AutoModelForSequenceClassification.from_pretrained("bert-base-uncased")
143
-
144
-
# Define the training arguments
145
-
- training_args = TrainingArguments(
146
-
+ training_args = ORTTrainingArguments(
147
-
output_dir="path/to/save/folder/",
148
-
optim="adamw_ort_fused",
149
-
...
150
-
)
151
-
152
-
# Create a ONNX Runtime Trainer
153
-
- trainer = Trainer(
154
-
+ trainer = ORTTrainer(
155
-
model=model,
156
-
args=training_args,
157
-
train_dataset=train_dataset,
158
-
+ feature="text-classification", # The model type to export to ONNX
159
-
...
160
-
)
161
-
162
-
# Use ONNX Runtime for training!
163
-
trainer.train()
164
-
```
165
-
166
-
You can find more examples in the [documentation](https://huggingface.co/docs/optimum/onnxruntime/usage_guides/trainer) and in the [examples](https://github.com/huggingface/optimum/tree/main/examples/onnxruntime/training).
167
-
168
132
## Out of the box ONNX export
169
133
170
134
The Optimum library handles out of the box the ONNX export of Transformers and Diffusers models!
0 commit comments