Skip to content
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

AttributeError: module 'torch.cuda.amp' has no attribute 'autocast' #22

Open
weqvr opened this issue Nov 18, 2020 · 6 comments
Open

AttributeError: module 'torch.cuda.amp' has no attribute 'autocast' #22

weqvr opened this issue Nov 18, 2020 · 6 comments

Comments

@weqvr
Copy link

weqvr commented Nov 18, 2020

AttributeError: module 'torch.cuda.amp' has no attribute 'autocast'

@WongKinYiu
Copy link
Owner

what is your pytorch version?
it seems your pytorch version is too old.

@huangruofei
Copy link

Have you solved this problem? I have the same problem

@huangruofei
Copy link

@weqvr

@Code-keys
Copy link

Code-keys commented Nov 22, 2020

1、update your torch to 1.6+
2、return to use apex : "from apex import amp" and modify the code related.

@weqvr
Copy link
Author

weqvr commented Nov 23, 2020

i solve this problem by installing torch=1.7.0

@laygond
Copy link

laygond commented Dec 14, 2021

Yes, this model makes use of torch.cuda.amp which is available after pytorch v1.5; however, each pytorch version is built based on a CUDA version. For example, the maximum corresponding pytorch version for cuda 10.1 is pytorch 1.7.1 and therefore within the correct parameters (cuda 10.0 has a maximum pytorch version of 1.2). Also, this model architecture makes use of a manually installed mish-activation-function. Newer versions of Pytorch v1.9+ include built-in mish but you will have to change WongKinYiu's code (plus upgrade your cuda to 10.2+).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants