I am using keras_tuner's Hyperband for hyperparameter tuning and it creates about 30 folders for all it's trials. So what I have to do right now is first create the model with all the hyperparameters and then load it's weights from checkpoints.
I want to find a way that utilizes less space because I have to do this for about 1k entities and train a different model for them all.
My current method of loading a saved model:
best_hps = tuner.get_best_hyperparameters(num_trials=1)[0]
my_model= tuner.hypermodel.build(best_hps)
my_model.load_weights(filepath).expect_partial()
My only problem is each model takes a lot of space because of it's hyperparameter tuning. Can I save the model fully with weights and hyperparameters.
I tried keras's save_model and load_model and even tried saving the trained model as h5 file but none of them worked.
Is there something I'm missing? How can I solve this problem? Thank you!
from Is there a way to save a model with hyperparameters and weights both after hyperparameter tuning and model training?
No comments:
Post a Comment