MCPcopy Create free account
hub / github.com/AI-Hypercomputer/maxtext / maybe_activate_profiler

Method maybe_activate_profiler

src/MaxText/profiler.py:51–59  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

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.

Callers 4

train_loopFunction · 0.95
train_loopFunction · 0.95
train_loopFunction · 0.95
train_loopFunction · 0.95

Calls 2

activateMethod · 0.95

Tested by

no test coverage detected