-
Notifications
You must be signed in to change notification settings - Fork 27.3k
Description
🐛 Describe the bug
In the torch.optim.Adam:
@torch.no_grad()
def step(self, closure=None):
"""Performs a single optimization step.
Args:
closure (callable, optional): A closure that reevaluates the model
and returns the loss.
"""
self._cuda_graph_capture_health_check()
...
Calls the _cuda_graph_capture_health_check()
# Currently needed by Adam and AdamW
def _cuda_graph_capture_health_check(self):
if torch.has_cuda and torch.cuda.is_available():
capturing = torch.cuda.is_current_stream_capturing()
if capturing and not self.defaults['capturable']:
raise RuntimeError("Attempting CUDA graph capture of step() for an instance of " +
self.__class__.__name__ +
" but this instance was constructed with capturable=False.")
if (not self._warned_capturable_if_run_uncaptured) and self.defaults['capturable'] and (not capturing):
print("Warning: This instance was constructed with capturable=True, but step() " +
"is running without CUDA graph capture. If you never intend to graph-capture this " +
"instance, capturable=True can impair performance, and you should set capturable=False.")
self._warned_capturable_if_run_uncaptured = True
And
if (not self._warned_capturable_if_run_uncaptured)
Raise Error:
AttributeError: 'Adam' object has no attribute '_warned_capturable_if_run_uncaptured'
Versions
Collecting environment information...
PyTorch version: 1.12.0
Is debug build: False
CUDA used to build PyTorch: 11.6
ROCM used to build PyTorch: N/A
OS: Ubuntu 20.04.4 LTS (x86_64)
GCC version: (Ubuntu 9.4.0-1ubuntu1~20.04.1) 9.4.0
Clang version: Could not collect
CMake version: Could not collect
Libc version: glibc-2.31
Python version: 3.8.13 (default, Mar 28 2022, 11:38:47) [GCC 7.5.0] (64-bit runtime)
Python platform: Linux-5.13.0-52-generic-x86_64-with-glibc2.17
Is CUDA available: True
CUDA runtime version: Could not collect
GPU models and configuration: GPU 0: NVIDIA GeForce RTX 3080 Ti
Nvidia driver version: 515.43.04
cuDNN version: Could not collect
HIP runtime version: N/A
MIOpen runtime version: N/A
Is XNNPACK available: True
Versions of relevant libraries:
[pip3] numpy==1.22.3
[pip3] pytorch-benchmark==0.3.4
[pip3] torch==1.12.0
[pip3] torchaudio==0.12.0
[pip3] torchvision==0.13.0
[conda] blas 1.0 mkl
[conda] cudatoolkit 11.6.0 hecad31d_10 conda-forge
[conda] ffmpeg 4.3 hf484d3e_0 pytorch
[conda] mkl 2021.4.0 h06a4308_640
[conda] mkl-service 2.4.0 py38h95df7f1_0 conda-forge
[conda] mkl_fft 1.3.1 py38h8666266_1 conda-forge
[conda] mkl_random 1.2.2 py38h1abd341_0 conda-forge
[conda] numpy 1.22.3 py38he7a7128_0
[conda] numpy-base 1.22.3 py38hf524024_0
[conda] pytorch 1.12.0 py3.8_cuda11.6_cudnn8.3.2_0 pytorch
[conda] pytorch-benchmark 0.3.4 pypi_0 pypi
[conda] pytorch-mutex 1.0 cuda pytorch
[conda] torchaudio 0.12.0 py38_cu116 pytorch
[conda] torchvision 0.13.0 py38_cu116 pytorch
cc @ezyang @gchanan @zou3519 @vincentqb @jbschlosser @albanD @mcarilli