Skip to content

Commit

Permalink
Update pytorch_lightning/plugins/precision/native_amp.py
Browse files Browse the repository at this point in the history
Co-authored-by: thomas chaton <thomas@grid.ai>
  • Loading branch information
carmocca and tchaton authored Oct 26, 2021
1 parent 6d3f60e commit 153f7f4
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions pytorch_lightning/plugins/precision/native_amp.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@ def __init__(
)
if scaler is None and precision == 16:
scaler = torch.cuda.amp.GradScaler()
if scaler is not None and precision == "bf16":
raise MisconfigurationException(f"`precision='bf16'` does not use a scaler, found {scaler}.")
self.precision = precision
self.device = device
self.scaler = scaler
Expand Down

0 comments on commit 153f7f4

Please sign in to comment.