I want to save not just one but the top 3 best performing models created by AutoKeras. I want to analyze the differences between them. How can I save them?
You can use AutoModel.tuner.get_best_models(3)
You can use
AutoModel.tuner.get_best_models(3)
This will enlist the best 3 models. I want to save these models or export them. Is there any way to do this?
@abdulsam You can use a for loop to do so.
for index, model in enumerate(AutoModel.tuner.get_best_models(3)):
model.save('model' + str(index) + '.h5')
@haifeng-jin While loading the saved models, it is giving a warning
WARNING:tensorflow:Error in loading the saved optimizer state. As a result, your model is starting with a freshly initialized optimizer.
I ignored this warning because I can train it again. But while using fit() method on the loaded model, it is showing this error:
ValueError: Shapes (None, 1) and (None, 10) are incompatible
I guess it is because of the label encoding? We do a one-hot encoding for the labels under the hood.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
Most helpful comment
@abdulsam You can use a for loop to do so.