ValueError: Invalid filepath extension for saving. Please add either a `.keras` extension for the native Keras format (recommended) or a `.h5` extension. Use `model.export(filepath)` if you want to export a SavedModel for use with TFLite/TFServing/etc. Received: filepath=model.
If I actually save it with a .h5 or a .keras extension at the end I get an error at runtime in the cpp script that is like:
2024-11-02 17:35:43.198951: I tensorflow/cc/saved_model/reader.cc:83] Reading SavedModel from: complex_model.keras
2024-11-02 17:35:43.198995: I tensorflow/cc/saved_model/loader.cc:466] SavedModel load for tags { serve }; Status: fail: NOT_FOUND: Could not find SavedModel .pb or .pbtxt at supplied export directory path: complex_model.keras. Check that the directory exists and that you have the right permissions for accessing it.. Took 49 microseconds.
terminate called after throwing an instance of 'std::runtime_error'
what(): Could not find SavedModel .pb or .pbtxt at supplied export directory path: complex_model.keras. Check that the directory exists and that you have the right permissions for accessing it.
Aborted (core dumped)
This can be done by doing
model.save("model_name")
. Tensorflow will save the model in thesaved_model
format if you don't put.h5
in "model_name".Originally posted by @yochananscharf in https://github.com/serizba/cppflow/issues/219#issuecomment-1290196967
Sorry, I am having a similar problem. When I try to save this dummy model:
I get ths error:
If I actually save it with a .h5 or a .keras extension at the end I get an error at runtime in the cpp script that is like: