MCPcopy
hub / github.com/NVIDIA-NeMo/RL / time

Method time

nemo_rl/utils/timer.py:110–123  ·  view source on GitHub ↗

Context manager for timing a block of code. Args: label: The label to use for this timing Yields: None

(self, label: str)

Source from the content-addressed store, hash-verified

108
109 @contextmanager
110 def time(self, label: str) -> Generator[None, None, None]:
111 """Context manager for timing a block of code.
112
113 Args:
114 label: The label to use for this timing
115
116 Yields:
117 None
118 """
119 self.start(label)
120 try:
121 yield
122 finally:
123 self.stop(label)
124
125 def get_elapsed(self, label: str) -> list[float]:
126 """Get all elapsed time measurements for a specific label.

Callers 15

run_rolloutsMethod · 0.95
distillation_trainFunction · 0.95
validateFunction · 0.95
validate_one_datasetFunction · 0.95
dpo_trainFunction · 0.95
validateFunction · 0.95
sft_trainFunction · 0.95
validate_one_datasetFunction · 0.95
rm_trainFunction · 0.95
grpo_trainFunction · 0.95
validateFunction · 0.95

Calls 2

startMethod · 0.95
stopMethod · 0.95