MCPcopy Create free account
hub / github.com/deepspeedai/DeepSpeed / __init__

Method __init__

deepspeed/utils/timer.py:208–229  ·  view source on GitHub ↗
(self, config, batch_size, start_step=2, steps_per_output=None, monitor_memory=False, logging_fn=None)

Source from the content-addressed store, hash-verified

206class ThroughputTimer:
207
208 def __init__(self, config, batch_size, start_step=2, steps_per_output=None, monitor_memory=False, logging_fn=None):
209 from deepspeed.utils import logger
210 self.config = config
211 self.start_time = 0
212 self.end_time = 0
213 self.started = False
214 self.batch_size = 1 if batch_size is None else batch_size
215 self.start_step = start_step
216 self.epoch_count = 0
217 self.micro_step_count = 0
218 self.global_step_count = 0
219 self.total_elapsed_time = 0
220 self.step_elapsed_time = 0
221 self.steps_per_output = steps_per_output
222 self.monitor_memory = monitor_memory
223 self.logging = logging_fn
224 if self.logging is None:
225 self.logging = logger.info
226 self.initialized = False
227
228 if self.monitor_memory and importlib.util.find_spec("psutil") is None:
229 raise ImportError("Unable to import 'psutils', please install package")
230
231 def update_epoch_count(self):
232 self.epoch_count += 1

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected