Hi All,
I am using wsl2 on windows 10 and using PyTorch versions as below:
pytorch 2.1.0 py3.11_cuda12.1_cudnn8.9.2_0 pytorch
pytorch-cuda 12.1 ha16c6d3_5 pytorch
I get the following error:
Starting Training Loop...
torch.Size([128, 3, 128, 128])
Traceback (most recent call last):
File "/mnt/c/Users/hjakkamk/Downloads/2-ADRL/Assignment/assignment-2/assignment2.py", line 280, in <module>
errD_real.backward()
File "/home/hjakkamk/miniconda3/lib/python3.11/site-packages/torch/_tensor.py", line 492, in backward
torch.autograd.backward(
File "/home/hjakkamk/miniconda3/lib/python3.11/site-packages/torch/autograd/__init__.py", line 251, in
backward
Variable._execution_engine.run_backward( # Calls into the C++ engine to run the backward pass
RuntimeError: handle_0 INTERNAL ASSERT FAILED at "/opt/conda/conda-bld/pytorch_1695392035891/work/c10/cuda/driver_api.cpp":15, please report a bug to PyTorch.
When I run the code:
print("Starting Training Loop...")
# For each epoch
for epoch in range(num_epochs):
# For each batch in the dataloader
for i, data in enumerate(dataloader, 0):
############################
# (1) Update D network: maximize log(D(x)) + log(1 - D(G(z)))
###########################
## Train with all-real batch
netD.zero_grad()
# Format batch
real_cpu = data[0].to(device)
print(real_cpu.shape)
b_size = real_cpu.size(0)
# print(b_size)
label = torch.full((b_size,), real_label, dtype=torch.float, device=device)
# Forward pass real batch through D
output = netD(real_cpu).view(-1)
# print(output.shape)
# Calculate loss on all-real batch
errD_real = criterion(output[:batch_size], label)
# Calculate gradients for D in backward pass
errD_real.backward()
D_x = output.mean().item()
The error is at line errD_real.backward().
Appreciate any help on this. Thanks!