Skip to content

Commit

Permalink
Update miner.py
Browse files Browse the repository at this point in the history
  • Loading branch information
pengbo0054 authored May 23, 2021
1 parent ea16987 commit e56421f
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions minetorch/miner.py
Original file line number Diff line number Diff line change
Expand Up @@ -499,12 +499,11 @@ def run_train_iteration(self, index, data, train_iters):
total_iters=train_iters,
iteration=self.current_train_iteration,
)
if self.amp:
if self.amp and self.amp_scaler:
with torch.cuda.amp.autocast():
_, loss = self._forward(data)
seperate_loss = loss / self.accumulated_iter
if self.amp_scaler:
seperate_loss = self.scaler.scale(seperate_loss)
seperate_loss = self.scaler.scale(seperate_loss)
else:
_, loss = self._forward(data)
seperate_loss = loss / self.accumulated_iter
Expand Down

0 comments on commit e56421f

Please sign in to comment.