konstmish / prodigy

The Prodigy optimizer and its variants for training neural networks.
MIT License
326 stars 20 forks source link

module 'torch.optim' has no attribute 'Prodigy' #2

Closed DarkAlchy closed 1 year ago

DarkAlchy commented 1 year ago

module 'torch.optim' has no attribute 'Prodigy'

I am on pytorch 2.

konstmish commented 1 year ago

I see the issue is already closed, but I'll respond just in case. The optimizer is indeed not provided as part of PyTorch, you can only import it if you install the package separately. You can do it with pip by running pip install prodigyopt and then the optimizer needs to be imported not from torch.optim but from the installed package: from prodigyopt import Prodigy

DarkAlchy commented 1 year ago

Yes, I found that out. Thank you.

jj-a-li commented 1 year ago

how to imported from the installed package?

konstmish commented 1 year ago

Just run from prodigyopt import Prodigy and then opt = Prodigy(net.parameters()) will give you the default version of the optimizer (change net to the name of your initialized network if it's different).