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

Chapter 6 - audionet.save fails #8

Closed
PCJimmmy opened this issue Feb 11, 2020 · 2 comments
Closed

Chapter 6 - audionet.save fails #8

PCJimmmy opened this issue Feb 11, 2020 · 2 comments

Comments

@PCJimmmy
Copy link

the cell with

audionet.save("audionet.pth")

fails with error message
AttributeError: 'AudioNet' object has no attribute 'save'

So of course later attempts to load this pth also fail.

Running the code on Ubuntu 19.10 and an Ananconda python setup

@PCJimmmy
Copy link
Author

Also have a Windows 10 machine - but getting torchaudio even installed seems like a huge task not worth the effort. Not sure if your early section suggests that Windows 10 might be a no go?

@falloutdurham
Copy link
Owner

Ah, that's my fault. I added a helper method that automatically does the saving and loading of state dicts and did not expand it when I brought the code across here. You should instead do:

torch.save(audionet.state_dict(), "audionet.pth")

And later:

audionet.load_state_dict(torch.load("audionet.pth"))

I'll update the code here and in the book this weekend. As for Windows 10, it is probably going to be a slog, yes - especially if you try to use things like sox. I'd recommend using Google's Colab rather than trying to run things directly on the box

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