Description
Please make sure that this is a bug. As per our
GitHub Policy,
we only address code/doc bugs, performance issues, feature requests and
build/installation issues on GitHub. tag:bug_template
System information
- OS Platform and Distribution: MacOS Sequoia 15.5
- TensorFlow.js installed from (npm or script link): Pip
- TensorFlow.js version (use command below): 4.22.0
- Tensorflow.js Converter Version: 4.22.0
Describe the current behavior
When saving a model from Python Tensorflow to Javascript (JSON) I got this warning:
You are saving your model as an HDF5 file via model.save() or keras.saving.save_model(model). This file format is considered legacy.
We recommend using instead the native Keras format, e.g. model.save('my_model.keras') or keras.saving.save_model(model, 'my_model.keras'). Failed to lookup keras version from the file, this is likely a weight only file.
Tried saving the file through bash or project, but got the same result.
tfjs.converters.save_keras_model(model, '../saved-models/model-js')
tensorflowjs_converter --input_format=keras /tmp/model.h5 /tmp/tfjs_model
And when importing the JSON file to a JavaScript project, I got an error:
An InputLayer should be passed either a batchInputShape or an inputShape.
const model = await tf.loadLayersModel('assets/models/bitcoin-lstm-model-js/model.json');
I've tried to downgrade the tensorflowjs to version 2.15, but it breaks the other import dependencies.
Is there anything that I can do?