BUG: can't grid search optimizers
See original GitHub issueIt turns out that Keras optimizers are not picklable because they use lambdas inside functions 🤦
This can be fixed by using tf.keras.optimizers.serialize and tf.keras.optimizers.deserialize.
I think that maybe we need to list out all of the keras object types Model, optimizers, callbacks, etc. and use copyreg.pickle to register how to pickle each one using their custom keras serialize/deserialize methods.
Issue Analytics
- State:
- Created 3 years ago
- Comments:9 (6 by maintainers)
Top Results From Across the Web
I can't add optimizer parameter in gridsearch - Stack Overflow
I wanna test the model with different optimizer. But I can't seem to add optimizer in grid search. Whenever I run the program,...
Read more >Are You Still Using Grid Search for Hyperparameters ...
Are You Still Using Grid Search for Hyperparameters Optimization? Let's discuss the ideas behind how to search in a smart fashion the ...
Read more >How to Grid Search Hyperparameters for Deep Learning ...
Grid search is a model hyperparameter optimization technique. ... I am experiencing the same error “can't pickle _thread.
Read more >Error when Keras model is used in grid search ... - GitHub
Hi all, I understand KerasClassifier can be used to wrap a Keras model and input to grid_search/cross_val_score in scikit-learn. But I can't ......
Read more >Is it possible to get worse model after optimization?
Secondly, a grid search where you don't really know where to look should contain a much larger variance for the parameters.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

So the RFC was approved on the Keras end, but it did not cover the specific use case here, which includes
optimizers,losses,metricsandcallbacks. The pushback on these was mainly surrounding optimizers, given that there is no singular “official” API for serializing optimizers with their weights. Instead, we would have to calltf.keras.optimizers.Optimizer.get_weights/tf.keras.optimizers.Optimizer.set_weights.We may not be able to upstream this since there is no clear use case in Keras for serializing optimizers, callbacks, etc. outside of a
Model.Resolved by #128