autokeras: Model saving doesn't work for StructuredDataRegressor
Bug Description
I can’t save the best model as h5 or even a tf file
Bug Reproduction
Code for reproducing the bug:
model = regressor.export_model()
model.save('testmodel.h5')
gives me
NotImplementedError: Save or restore weights that is not an instance of `tf.Variable` is not supported in h5, use `save_format='tf'` instead. Got a model or layer CategoricalEncoding with weights ....
It suggests I use tf
instead of h5
, but when I do that I get this error
model.save('testmodel', save_format='tf')
2020-04-03 14:44:31.041453: W tensorflow/python/util/util.cc:329] Sets are not currently considered sequences, but this may change in the future, so consider avoiding using them.
*** RuntimeError: Attempting to capture an EagerTensor without building a function.
Data used by the code:
Expected Behavior
Save the best model in either h5 or tf format
Setup Details
- OS type and version: Ubuntu 18.04.01
- Python: 3.6.6
- autokeras: 1.0.2
- scikit-learn: 0.20.3
- numpy: 1.18.2
- pandas: 1.0.1
- tensorflow: 2.2.0-dev20200401 (nightly)
Additional context
I also can’t load the model json after saving it but I think that’s related to #1023
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Comments: 19 (5 by maintainers)
As I tested the latest version of AutoKeras can save the structureddataregressor fine.
@utkarshgupta137
save and load model
create: model_name - you select own name; directory - you select place for model’s data
save after creating: model_name - your selected name on previouse stage
save_pickle_model_to_file(model, model_name)
Issue solved in the latest version, thanks.