Skip to main content

GPU Monitoring Callbacks for TensorFlow and PyTorch Lightning

Project description


Pypi Version Licence Frameworks

gpumonitor gives you stats about GPU usage during execution of your scripts and trainings, as TensorFlow or Pytorch Lightning callbacks.


Installation can be done directly from this repository:

pip install gpumonitor

Getting started

Option 1: In your scripts

monitor = gpumonitor.GPUStatMonitor(delay=1)

# Your instructions here
# [...]


It keeps track of the average of GPU statistics. To reset the average and start from fresh, you can also reset the monitor:

monitor = gpumonitor.GPUStatMonitor(delay=1)

# Your instructions here
# [...]


# Some other instructions
# [...]


Option 2: Callbacks

Add the following callback to your training loop:

For TensorFlow,

from import TFGpuMonitorCallback, y, callbacks=[TFGpuMonitorCallback(delay=0.5)])

For PyTorch Lightning,

from gpumonitor.callbacks.lightning import PyTorchGpuMonitorCallback

trainer = pl.Trainer(callbacks=[PyTorchGpuMonitorCallback(delay=0.5)])

Display Format

You can customize the display format according to the gpustat options. For example, display of watts consumption, fan speed are available. To know which options you can change, refer to:


  • Built on top of GPUStat
  • Separate thread loop coming from gputil

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

gpumonitor-0.1.2.tar.gz (3.8 kB view hashes)

Uploaded source

Built Distribution

gpumonitor-0.1.2-py3-none-any.whl (5.7 kB view hashes)

Uploaded py3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page