GPU Monitoring Callbacks for TensorFlow and PyTorch Lightning
Project description
gpumonitor
gpumonitor
gives you stats about GPU usage during execution of your scripts and trainings,
as TensorFlow or
Pytorch Lightning callbacks.
Installation
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
# [...]
monitor.stop()
monitor.display_average_stats_per_gpu()
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
# [...]
monitor.display_average_stats_per_gpu()
monitor.reset()
# Some other instructions
# [...]
monitor.display_average_stats_per_gpu()
Option 2: Callbacks
Add the following callback to your training loop:
For TensorFlow,
from gpumonitor.callbacks.tf import TFGpuMonitorCallback
model.fit(x, y, callbacks=[TFGpuMonitorCallback(delay=0.5)])
For PyTorch Lightning,
from gpumonitor.callbacks.lightning import PyTorchGpuMonitorCallback
trainer = pl.Trainer(callbacks=[PyTorchGpuMonitorCallback(delay=0.5)])
trainer.fit(model)
Sources
Project details
Release history Release notifications | RSS feed
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.1.tar.gz
(3.4 kB
view hashes)
Built Distribution
Close
Hashes for gpumonitor-0.1.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 34b8d5dfcf8d6f951473b67ec933b398793254feb7449eeced3fda3011b28bf4 |
|
MD5 | 374e55e67ea3b23128defc216ab0d936 |
|
BLAKE2b-256 | f13b79d3d14a2a83c4985f2fdf9eb9467a6f512d8aa06d28aeddaac4151b4886 |