Passing Learning rate
saravananpsg opened this issue · 3 comments
How to pass the learning rate for these model ?
I tried to update the config.json and
1st try - passed the learning rate before compile the model.
2nd try - set the value from Keras Backend for optimiser learning rate
Both the times, I am unable to pass the learning rates. Is there any way to pass the learning rates ?
I have tried this one and it worked :
model.compile(optimizer=Adam(lr=self.learning_rate), loss=self.loss, metrics=['accuracy'])
Yeah, that should work. Your problem was happening because of how Keras allows you to pass the optimizer as either a string or an object.
This codebase was configured to pass the optimizer's name as a string (so 'adam', 'sgd' etc.) which used the default parameters. However, if you actually instantiate a Keras optimizer object and pass that to the model when compiling it, you can configure optimizer parameters.
There's also a manual way of setting the optimizer's parameters using the Keras backend. For example:
K.set_value(model.optimizer.lr, <your-learning-rate>)