File tree Expand file tree Collapse file tree 1 file changed +13
-0
lines changed
docs/source-pytorch/tuning Expand file tree Collapse file tree 1 file changed +13
-0
lines changed Original file line number Diff line number Diff line change @@ -11,6 +11,19 @@ Find bottlenecks in your code
1111
1212.. Add callout items below this line
1313
14+ .. warning ::
15+
16+ Do **not ** wrap ``Trainer.fit() ``, ``Trainer.validate() ``, or similar Trainer methods inside a manual ``torch.profiler.profile `` context manager.
17+ This will cause unexpected crashes and cryptic errors due to incompatibility between PyTorch Profiler's context and Lightning's training loop.
18+ Instead, use the ``profiler `` argument of the ``Trainer ``:
19+
20+ .. code-block :: python
21+
22+ trainer = pl.Trainer(
23+ profiler = " pytorch" , # This is the correct and supported way
24+ ...
25+ )
26+
1427 .. displayitem ::
1528 :header: Basic
1629 :description: Learn to find bottlenecks in the training loop.
You can’t perform that action at this time.
0 commit comments