Skip to content

Commit d47a534

Browse files
Torch compile backend defaults to "neuron" (#47035)
* feat: torch compile backend defaults to "neuron" * fix: restore doc back to normal * doc: add information about backend in docs
1 parent d610229 commit d47a534

2 files changed

Lines changed: 5 additions & 1 deletion

File tree

docs/source/en/torch_compile.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,9 @@ args = TrainingArguments(
3232

3333
## Backend
3434

35-
The default backend is `inductor`, which compiles to Triton kernels with AOTAutograd. This is the right choice for most training workloads. Use `cudagraphs` for fixed-shape inputs, or `ipex` for Intel CPU training.
35+
When no backend is specified, [`TrainingArguments`] selects one based on your hardware. On most CPUs and GPUs, the default is `inductor`, which compiles to Triton kernels with AOTAutograd and suits most training workloads. On Intel Gaudi (HPU), the default is `hpu_backend`. On AWS Trainium and Inferentia (Neuron), the default is `neuron`.
36+
37+
Use `cudagraphs` for fixed-shape inputs, or `ipex` for Intel CPU training.
3638

3739
## Compile mode
3840

src/transformers/training_args.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1565,6 +1565,8 @@ def __post_init__(self):
15651565
if self.torch_compile and self.torch_compile_backend is None:
15661566
if not self.use_cpu and is_torch_hpu_available():
15671567
self.torch_compile_backend = "hpu_backend"
1568+
elif not self.use_cpu and is_torch_neuron_available():
1569+
self.torch_compile_backend = "neuron"
15681570
else:
15691571
self.torch_compile_backend = "inductor"
15701572

0 commit comments

Comments
 (0)