human-pose-estimation.pytorch
human-pose-estimation.pytorch copied to clipboard
Help with running this code on Windows 10
How can I disable cudnn for batch_norm in Windows 10? I tried to run the code with out doing it, I got this output: File "C:\Users\pc\Desktop\pose-project\human-pose-estimation.pytorch-master\pose_estimation..\lib\core\function.py", line 52, in train loss.backward() File "C:\Users\pc\Anaconda3\envs\tensorflow\lib\site-packages\torch\tensor.py", line 102, in backward torch.autograd.backward(self, gradient, retain_graph, create_graph) File "C:\Users\pc\Anaconda3\envs\tensorflow\lib\site-packages\torch\autograd_init_.py", line 90, in backward allow_unreachable=True) # allow_unreachable flag RuntimeError: element 0 of tensors does not require grad and does not have a grad_fn
In the "main" function I added -"with torch.no_grad():" to solve a memory error. Maybe that is the problem? Any help will be appreciated.
Does pytorch not have this file on Windows10?
${PYTORCH}/torch/nn/functional.py
(I'm going to run this code in Win10 too, but not already)
Looks like all that is doing is replacing "torch.backends.cudnn.enabled" with "False" in functional.py. That file should be found in your python site-package folder, under "torch/nn/". For example, for me that file is located at: E:\Python37\lib\site-packages\torch\nn\functional.py or if you use git-bash as I do: /e/python37/lib/site-packages/torch/nn/functional.py
So you can open that file, find all occurrences of "torch.backends.cudnn.enabled" (in the function returns), and simply return False in place.
For example, change:
return torch.instance_norm(
input, weight, bias, running_mean, running_var,
use_input_stats, momentum, eps, torch.backends.cudnn.enabled
)
to:
return torch.instance_norm(
input, weight, bias, running_mean, running_var,
use_input_stats, momentum, eps, False
)
HTH