Skip to content

Commit

Permalink
Use torch.amp.autocast instead of deprecated torch.cuda.amp.autocast …
Browse files Browse the repository at this point in the history
…in nemotron

Signed-off-by: Dmitry Rogozhkin <[email protected]>
  • Loading branch information
dvrogozh committed Nov 27, 2024
1 parent d476d8d commit 0191f49
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/transformers/models/nemotron/modeling_nemotron.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ def __init__(

def forward(self, input: Tensor) -> Tensor:
args = _cast_if_autocast_enabled(input, self.normalized_shape, self.weight + 1, self.bias, self.eps)
with torch.cuda.amp.autocast(enabled=False):
with torch.amp.autocast(input.device.type, enabled=False):
return F.layer_norm(*args)


Expand Down

0 comments on commit 0191f49

Please sign in to comment.