(self, lr_kwargs=None)
| 1210 | self.timers(PIPE_RECV_GRAD_TIMER).stop() |
| 1211 | |
| 1212 | def _exec_optimizer_step(self, lr_kwargs=None): |
| 1213 | if self.wall_clock_breakdown(): |
| 1214 | self.timers(STEP_MICRO_TIMER).start() |
| 1215 | self.timers(STEP_GLOBAL_TIMER).start() |
| 1216 | |
| 1217 | self._force_grad_boundary = True |
| 1218 | self._take_model_step(lr_kwargs) |
| 1219 | self._force_grad_boundary = False |
| 1220 | |
| 1221 | if self.global_rank == 0 and self.monitor.enabled: |
| 1222 | self.summary_events = [('Train/Samples/lr', self.get_lr()[0], self.global_samples)] |
| 1223 | loss_scale = self._get_optimizer_loss_scale() if self.fp16_enabled() else None |
| 1224 | if loss_scale is not None: |
| 1225 | self.summary_events.append(('Train/Samples/loss_scale', loss_scale, self.global_samples)) |
| 1226 | self.monitor.write_events(self.summary_events) |
| 1227 | |
| 1228 | if self.wall_clock_breakdown(): |
| 1229 | self.timers(STEP_MICRO_TIMER).stop() |
| 1230 | self.timers(STEP_GLOBAL_TIMER).stop() |
| 1231 | if self.global_steps % self.steps_per_print() == 0: |
| 1232 | self.timers.log([ |
| 1233 | BATCH_INPUT_TIMER, |
| 1234 | FORWARD_MICRO_TIMER, |
| 1235 | BACKWARD_MICRO_TIMER, |
| 1236 | BACKWARD_INNER_MICRO_TIMER, |
| 1237 | BACKWARD_REDUCE_MICRO_TIMER, |
| 1238 | STEP_MICRO_TIMER, |
| 1239 | ]) |
| 1240 | if self.global_steps % self.steps_per_print() == 0: |
| 1241 | self.timers.log([ |
| 1242 | FORWARD_GLOBAL_TIMER, |
| 1243 | BACKWARD_GLOBAL_TIMER, |
| 1244 | BACKWARD_INNER_GLOBAL_TIMER, |
| 1245 | BACKWARD_REDUCE_GLOBAL_TIMER, |
| 1246 | STEP_GLOBAL_TIMER, |
| 1247 | ]) |
| 1248 | |
| 1249 | def _allocate_zeros(self, shape, **kwargs): |
| 1250 | """ Allocate a tensor of zeros on the engine's device. |
nothing calls this directly
no test coverage detected