Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't check overflow for bf16 data type #4512

Merged
merged 2 commits into from
Oct 27, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion deepspeed/runtime/zero/stage3.py
Original file line number Diff line number Diff line change
Expand Up @@ -1843,7 +1843,8 @@ def _overflow_clean_up(self, prev_scale):
def _overflow_check_and_loss_scale_update(self):

# First compute norm for all group so we know if there is overflow
self.check_overflow()
if self.dtype == torch.float16:
self.check_overflow()

#loss scaling related computation
prev_scale = self.loss_scale
Expand Down
3 changes: 2 additions & 1 deletion deepspeed/runtime/zero/stage_1_and_2.py
Original file line number Diff line number Diff line change
Expand Up @@ -1704,7 +1704,8 @@ def step(self, closure=None):
see_memory_usage(f"In step before checking overflow")

# First compute norm for all group so we know if there is overflow
self.check_overflow()
if self.dtype == torch.float16:
self.check_overflow()

prev_scale = self.loss_scale
self._update_scale(self.overflow)
Expand Down