TimeProfiler#
Lightning Callback which allows you to measure the time each step takes and log it during the training process.
Logged values#
TimeProfiler logs the following steps:
Name | Logged by default | Description |
---|---|---|
train batch | Time taken by forward, optimizer step, and backward during train step. | |
validation batch | Time taken by forward during validation step. | |
train epoch | Time taken by train epoch without validation. | |
validation epoch | Time taken by validation epoch. | |
avg train downtime* | Average downtime in training step. | |
avg val downtime | Average downtime in validation step. | |
backward | Time taken by backprop. | |
optimizer step | Time taken by optimizer. | |
total train downtime | Total downtime in training epoch. | |
total val downtime | Total downtime in validation epoch. |
*Downtime - the process during which model does not work (e.g. data loader is working now)
Usage#
from thunder.callbacks import TimeProfiler
from lightning import Trainer
# logs default keys and in addition backward and optimizer step
trainer = Trainer(callbacks=[TimeProfiler("backward", "optimizer step")])