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

i can't save model on colab #19

Open
komalanadkat opened this issue May 14, 2021 · 1 comment
Open

i can't save model on colab #19

komalanadkat opened this issue May 14, 2021 · 1 comment

Comments

@komalanadkat
Copy link

I tried to save this model on colab.
model_save_name = 'classifier.pt'
path = F"/content/gdrive/My Drive/{model_save_name}"
torch.save(LMF.state_dict(), path)

but found error
TypeError Traceback (most recent call last)
in ()
1 model_save_name = 'classifier.pt'
2 path = F"/content/gdrive/My Drive/{model_save_name}"
----> 3 torch.save(LMF.state_dict(), path)

TypeError: state_dict() missing 1 required positional argument: 'self'

@Justin1904
Copy link
Owner

Hi, from the code you showed it seems you are calling .state_dict method on the LMF class itself, rather than on a concrete instance of LMF class. You can refer to this PyTorch documentation on how to properly save checkpoints.

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

2 participants