mirror of
https://github.com/XuehaiPan/nvitop.git
synced 2026-05-21 06:45:24 -06:00
fix(callbacks): fix a potential attribute errors for newer PyTorch-Lightning
This commit is contained in:
parent
d71eb5103a
commit
c12b01701b
2 changed files with 6 additions and 1 deletions
|
|
@ -150,3 +150,4 @@ KiB
|
|||
tx
|
||||
rx
|
||||
ThroughputInfo
|
||||
pytorch
|
||||
|
|
|
|||
|
|
@ -119,7 +119,11 @@ class GpuStatsLogger(Callback): # pylint: disable=too-many-instance-attributes
|
|||
f'The root device type is {trainer.strategy.root_device.type}.',
|
||||
)
|
||||
|
||||
device_ids = trainer.data_parallel_device_ids
|
||||
try:
|
||||
device_ids = trainer.device_ids # pytorch-lightning >= 1.6.0
|
||||
except AttributeError:
|
||||
device_ids = trainer.data_parallel_device_ids # pytorch-lightning < 1.6.0
|
||||
|
||||
try:
|
||||
self._devices = get_devices_by_logical_ids(device_ids, unique=True)
|
||||
except (libnvml.NVMLError, RuntimeError) as ex:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue