Skip to content
This repository has been archived by the owner on Jun 27, 2021. It is now read-only.

Can't set attribute for learning rate #2

Closed
pzhenwen opened this issue Oct 27, 2019 · 10 comments
Closed

Can't set attribute for learning rate #2

pzhenwen opened this issue Oct 27, 2019 · 10 comments
Assignees
Labels
bug Something isn't working wontfix This will not be worked on

Comments

@pzhenwen
Copy link

Hello,

Installed your package and it turned out having issues of setting learning rate. Would you mind taking a look. Thank you!

~\Anaconda3\lib\site-packages\keras_gradient_accumulation\optimizers.py in get_updates(self, loss, params)
     76 
     77         # Use fake learning rate
---> 78         self.optimizer.lr = K.switch(update_cond, self.lr, 0.0)
     79 
     80         # Freeze momentum

AttributeError: can't set attribute
@pzhenwen pzhenwen added the bug Something isn't working label Oct 27, 2019
@dimitreOliveira
Copy link

To add further information,

I'm also having this issue, for me, this happens in the Kaggle environment, but on Google colab everything works fine, so I suppose it's something related to the VM environment.

@pzhenwen
Copy link
Author

To add further information,

I'm also having this issue, for me, this happens in the Kaggle environment, but on Google colab everything works fine, so I suppose it's something related to the VM environment.

Thanks Dimitre.

I think you are right. It seems to be the issue of the keras.optimizers installed in my local machine. I was trying another custom optimizer needing to initialize the learning rate (lr) inherited from keras/optimizers.py and it turned out having the same error. But when I put the exact same code on colab and it ran fine. To me, it could be due to the keras backend or something wrong with the codes in the keras/optimizer.

Any idea how to fix it?

CyberZHG added a commit that referenced this issue Oct 29, 2019
CyberZHG added a commit that referenced this issue Oct 29, 2019
@CyberZHG
Copy link
Owner

keras 2.2.4 => lr
keras 2.3.0 => learning_rate

@dimitreOliveira
Copy link

I have tested the updated version and it works fine, thanks @CyberZHG

@pzhenwen
Copy link
Author

Thank you both. @CyberZHG @dimitreOliveira.

After I was using the later version and changed the name to learning rate, the code finally worked. Thank you!

@stale
Copy link

stale bot commented Nov 4, 2019

Is this still relevant? If so, what is blocking it? Is there anything you can do to help move it forward?

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.

@stale stale bot added the wontfix This will not be worked on label Nov 4, 2019
@stale stale bot closed this as completed Nov 6, 2019
@aaronlockhartdev
Copy link

I'm still having this issue on keras 2.3.1. I get AttributeError: can't set attribute. Changing AdaBound lr to learning_rate doesn't work.

@RichardChangCA
Copy link

I'm still having this issue on keras 2.3.1. I get AttributeError: can't set attribute. Changing AdaBound lr to learning_rate doesn't work.

I think this is because the keras backend tensorflow version is not the proper one. Just try TensorFlow 2.0 instead of below and 2.1

@vikassalaria2412
Copy link

keras 2.2.4 => lr
keras 2.3.0 => learning_rate
This solution is working.In jupyter notebook please check keras version and then use lr or learning_rate

@Kosisochi
Copy link

I'm getting this error on Keras 2.4.3. I have tried both lr and learning_rate with no success.

is Keras Adam compatible with 2.4.3

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working wontfix This will not be worked on
Projects
None yet
Development

No branches or pull requests

7 participants