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: 'SGD' object has no attribute 'defaults' #357

Closed
amfapic opened this issue Dec 10, 2022 · 11 comments
Closed

AttributeError: 'SGD' object has no attribute 'defaults' #357

amfapic opened this issue Dec 10, 2022 · 11 comments

Comments

@amfapic
Copy link

amfapic commented Dec 10, 2022

Hi, when I try to run simswap in colab, I get this error. Can anybody please guide me on how to fix the error?
AttributeError Traceback (most recent call last)
in
14
15 torch.nn.Module.dump_patches = True
---> 16 model = create_model(opt)
17 model.eval()
18

5 frames
/usr/local/lib/python3.8/dist-packages/torch/optim/optimizer.py in setstate(self, state)
82 self.dict.update(state)
83 self._hook_for_profile() # To support multiprocessing pickle/unpickle.
---> 84 self.defaults.setdefault('differentiable', False)
85
86 def repr(self):

AttributeError: 'SGD' object has no attribute 'defaults'

@chenchong23
Copy link

I also met the same problem, did you solve it?

@amfapic
Copy link
Author

amfapic commented Dec 12, 2022

I also met the same problem, did you solve it?

hi. yes.
You should try previous pytorch versions (< 1.13):
pip install torch==1.8.1+cu111 torchvision==0.9.1+cu111 torchaudio==0.8.1 -f https://download.pytorch.org/whl/torch_stable.html

@amfapic
Copy link
Author

amfapic commented Dec 12, 2022 via email

@TransAmMan
Copy link

Was also having this issue. This fix works. Thank you amfatic

@tubi1
Copy link

tubi1 commented Dec 29, 2022

hi. yes You should try previous pytorch versions (< 1.13): pip install torch==1.8.1+cu111 torchvision==0.9.1+cu111 torchaudio==0.8.1 -f https://download.pytorch.org/whl/torch_stable.html

On Sun, Dec 11, 2022 at 8:28 PM chenchong23 @.> wrote: I also met the same problem, did you solve it? — Reply to this email directly, view it on GitHub <#357 (comment)>, or unsubscribe https://github.com/notifications/unsubscribe-auth/A4SORJCQHSIOXFID35YI7N3WMYB2NANCNFSM6AAAAAAS2F2VWI . You are receiving this because you authored the thread.Message ID: @.>

Hi, i did this but it doesnt seem to work anymore. Any other solution? Thanks in advanced! :)

@rishab-sharma
Copy link

@tubi1 This works,

pip install torch==1.8.1+cu111 torchvision==0.9.1+cu111 torchaudio==0.8.1
-f https://download.pytorch.org/whl/torch_stable.html

Try restarting your colab after installation

@amingomezd
Copy link

@tubi1 This works,

pip install torch==1.8.1+cu111 torchvision==0.9.1+cu111 torchaudio==0.8.1 -f https://download.pytorch.org/whl/torch_stable.html

Try restarting your colab after installation

Add the pip install and restart the runtime won't work.

@orlandomendozagarrido
Copy link

orlandomendozagarrido commented Jan 12, 2023

I found that using !pip install torchvision==0.9.1+cu111 torchaudio==0.8.1 -f https://download.pytorch.org/whl/torch_stable.html works. The previous answers had install torch==1.8.1+cu111 but it was incompatible with torchtext 0.14.0 so I did not need to install,( so by using current torch==1.13.1 it worked fine.)
image

@qhuy1901
Copy link

I found that using !pip install torchvision==0.9.1+cu111 torchaudio==0.8.1 -f https://download.pytorch.org/whl/torch_stable.html works. The previous answers had install torch==1.8.1+cu111 but it was incompatible with torchtext 0.14.0 so I did not need to install,( so by using current torch==1.13.1 it worked fine.) image

Sorry, but it not working :(

@souvikg544
Copy link

All these solutions won't work as of February , 2023. The below installations work -

!pip3 install torch==1.9.1+cu111 torchvision==0.10.1+cu111 torchaudio==0.9.1 torchtext==0.10.1 -f https://download.pytorch.org/whl/torch_stable.html

Hope this helps ... Do not forget to restart your runtime after the installation ..
And as always happy coding !

@neuralchen
Copy link
Owner

We fixed the "AttributeError: 'SGD' object has no attribute 'defaults' now" bug. If you have already downloaded arcface_checkpoint.tar, please download it again. Also, you also need to update the scripts in ./models/.

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

10 participants