RuntimeError: cuDNN error: CUDNN_STATUS_EXECUTION_FAILED while training attention GAN

here’s the snippet:

def gen_example(self, data_dic):
if cfg.TRAIN.NET_G == ‘’:
print(‘Error: the path for morels is not found!’)
else:
# Build and load the generator
text_encoder =
RNN_ENCODER(self.n_words, nhidden=cfg.TEXT.EMBEDDING_DIM)
state_dict =
torch.load(cfg.TRAIN.NET_E, map_location=lambda storage, loc: storage)
text_encoder.load_state_dict(state_dict)
print(‘Load text encoder from:’, cfg.TRAIN.NET_E)
text_encoder = text_encoder.cuda()
text_encoder.eval()
# the path to save generated images
if cfg.GAN.B_DCGAN:
netG = G_DCGAN()
else:
netG = G_NET()
s_tmp = cfg.TRAIN.NET_G[:cfg.TRAIN.NET_G.rfind(’.pth’)]
model_dir = cfg.TRAIN.NET_G
state_dict = \

USING GPU -NVIDIA GTX 1660Ti , Cuda version 9.0.176 , cudnn 7.4.1 , pytorch version = 1.0.0 in my pytorch environment
in my base cuda version is 10.2 and nvidia driver is 440

Hi Shivani,

could you post an executable code snippet with random inputs, so that we could try to reproduce this issue?
Also, could you post your setup, i.e. used GPU, CUDA + cudnn version, PyTorch version and how you’ve installed it, please?

Yeah done! I apologise I forgot to upload and write some essentials :sweat_smile:

Thanks for the setup information.
Could you update to the latest stable PyTorch version (1.5) and use the binaries with CUDA10.2?

Can you please clarify my one more doubt?
Is there any problem I will face if I have cuda version 10.2 , Nvidia driver 440 and working on python 2.7 with pytorch 1.5 ?
Thanks in advance :slight_smile:

For CUDA 10.2.89 you would need a driver >=440.33 as given in this table.
I thought Python2.7 support was dropped in PyTorch 1.5. Are you sure you are using the deprecated Python version? If so, I would highly recommend to use 3.7 or 3.8. :wink:

Also, you could create a new virtual environment (e.g. with conda) and install the binaries there to keep your base environment in its current state.

yeah I was running the code with python 2.7 as given in it’s requirement in the virtual environment but in base environment it was python 3.8 .
I am not able to figure out the problem causing CUDNN error, whenever I try to run any code on my GPU this happens, may be due to CUDA or the requirements are not getting met, since I am beginner in this :frowning_face:

When I tried with python 3.8, CUDA 10.2 , driver 440 , cudnn 7.6.5
getting this error
This is the reason why I wasn’t using Python 3.8

Thanks for the update.
As a workaround for now, you could disable cudnn via torch.backends.cudnn.enabled = False and try to run the code.

Could you also post the model definition, all arguments, as well as the input shapes to reproduce this error, please?