-
Notifications
You must be signed in to change notification settings - Fork 4.7k
uniform deepspeed overflow check #5424
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
base: master
Are you sure you want to change the base?
Conversation
|
Why not using tensor.isnan() and tensor.isinf()? |
| '''Checks for overflow in gradient across parallel process''' | ||
|
|
||
| def __init__(self, param_groups=None, mpu=None, zero_reduce_scatter=False, deepspeed=None): | ||
| def __init__(self, param_groups=None, mpu=None, zero_reduce_scatter=False, deepspeed=None, partition_grads=False): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Passing deepseed engine into a submodule is not a good design and create all sorts of cyclic reference issues. It is better to pass the specific attributes that are needed, such as enable_backward_allreduce
| timers = self.timers if self.wall_clock_breakdown() else NoopTimer() | ||
| optimizer = BF16_Optimizer(optimizer, | ||
| self.param_names, | ||
| deepspeed=self, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't pass self into submodules.
| self._setup_for_real_optimizer() | ||
|
|
||
| # Overflow check init | ||
| self.overflow = False |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should self.overflow be a class member since it seems to be only used once?
Before: Overflow check is scattered and duplicated in all places.
This PR:
cc @tjruwase