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 <dmitry.v.rogozhkin@intel.com>
  • Loading branch information
dvrogozh committed Nov 26, 2024
1 parent cbcf4ff commit 86f8b24
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 86f8b24

Please sign in to comment.
  NODES
COMMUNITY 1
Note 1
Project 3
USERS 1