Skip to content

Commit c1c2f86

Browse files
Update trainer.py
1 parent 82d7717 commit c1c2f86

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

src/lightning/pytorch/trainer/trainer.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -264,6 +264,14 @@ def __init__(
264264
profiler: To profile individual steps during training and assist in identifying bottlenecks.
265265
Default: ``None``.
266266
267+
.. note::
268+
Do **not** use a manual ``torch.profiler.profile`` context manager around
269+
``Trainer.fit()``, ``Trainer.validate()``, etc.
270+
This will lead to internal errors and cryptic crashes due to incompatibility between
271+
PyTorch Profiler and Lightning's training loop.
272+
Always use this ``profiler`` argument to enable profiling in Lightning.
273+
274+
267275
detect_anomaly: Enable anomaly detection for the autograd engine.
268276
Default: ``False``.
269277

0 commit comments

Comments
 (0)