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

Function maybe_record_goodput

src/MaxText/utils/goodput_utils.py:74–86  ·  view source on GitHub ↗

Record goodput if `enable_goodput_recording=True`.

(recorder, event_name, *args)

Source from the content-addressed store, hash-verified

72
73@contextlib.contextmanager
74def maybe_record_goodput(recorder, event_name, *args):
75 """Record goodput if `enable_goodput_recording=True`."""
76 try:
77 start_event_name = f"record_{event_name.value}_start_time"
78 record_goodput(recorder, start_event_name, *args)
79 yield
80 except BaseException: # pylint: disable=W0706
81 raise
82 else:
83 end_event_name = f"record_{event_name.value}_end_time"
84 record_goodput(recorder, end_event_name, *args)
85 finally:
86 pass
87
88
89def record_goodput(recorder, event_name, *args):

Callers 13

train_loopFunction · 0.90
runFunction · 0.90
train_loopFunction · 0.90
mainFunction · 0.90
train_loopFunction · 0.90
mainFunction · 0.90
setup_train_loopFunction · 0.90
setup_trainer_stateFunction · 0.90
mainFunction · 0.90
setup_train_loopFunction · 0.90
mainFunction · 0.90

Calls 1

record_goodputFunction · 0.85

Tested by 1

test_record_goodputMethod · 0.72