Conditionally activates the profiler based on the current step. This method checks if the current training step matches the step designated for starting an initial profile, or if it meets the criteria for activating a new periodic profile.
(self, step, state)
| 49 | ManagedMLDiagnostics(config) # Initialize the MLRun instance. |
| 50 | |
| 51 | def maybe_activate_profiler(self, step, state): |
| 52 | """Conditionally activates the profiler based on the current step. |
| 53 | This method checks if the current training step matches the step designated |
| 54 | for starting an initial profile, or if it meets the criteria for |
| 55 | activating a new periodic profile. |
| 56 | """ |
| 57 | if self.mode != "" and (step == self.start_initial_profile_step or self.should_activate_periodic_profile(step)): |
| 58 | optional_postfix = f"step_{step}" if self.profile_period > 0 else "" |
| 59 | self.activate(blocking_object=state, optional_postfix=optional_postfix) |
| 60 | |
| 61 | def activate(self, blocking_object=None, optional_postfix=""): |
| 62 | """Start the profiler. |
no test coverage detected