-
Notifications
You must be signed in to change notification settings - Fork 198
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ImportError: cannot import name 'zero_gradients' from 'torch.autograd.gradcheck' #99
Comments
This issue is fixed in the code. It may have not been updated in the pip repo. Please re-install advertorch from the code (pip install -e .). sorry for the inconvenience. |
Ah, that worked. Thanks! |
Got it, thanks! I will still keep this issue open as it exists when install using normal Feel free to close it, |
This issue appeared again. |
This issue appeared again at pytorch 1.10 |
This solved for me in Colab:
@masoudhashemi @gwding can someone please update the pip package? |
The issue still persists in version 1.12 |
still has this problem, can anyone give any help? |
The error seems to have changed a bit from the start, but still seems to be a persistent issue with zero_gradients:
|
可以通过下面这个方法解决: from torch.autograd.gradcheck import zero_gradients 这句话运行不了,改为下面这段函数import torch.utils.data.dataloader as Data def zero_gradients(x): |
`from typing import Collection from torch.autograd.gradcheck import zero_gradients这句话运行不了,改为下面这段函数import torch.utils.data.dataloader as Data def zero_gradients(x): |
don't know what the cv2 refers |
This issue exists because this line:
from advertorch.attacks.utils import zero_gradients
which refers to the
zero_gradients
function in PyTorch is obsolete.This is because
zero_gradients
is removed from PyTorch 1.9. It was present until PyTorch 1.7.The text was updated successfully, but these errors were encountered: