Unable to save converted model locally.
Hello, I used the code and was able to train a model. When I converted the model from h5 to tflite, it didn't save, and I cannot find it anywhere.
`from tensorflow.keras.models import load_model from kapre.time_frequency import STFT, Magnitude, ApplyFilterbank, MagnitudeToDecibel import tensorflow as tf
Load the Keras model
model_path = r'models\lstm.h5' # Using a raw string for Windows path keras_model = tf.keras.models.load_model(model_path, custom_objects={ 'STFT': STFT, 'Magnitude': Magnitude, 'ApplyFilterbank': ApplyFilterbank, 'MagnitudeToDecibel': MagnitudeToDecibel })
Convert the model to TFLite
converter = tf.lite.TFLiteConverter.from_keras_model(keras_model) tflite_model = converter.convert()
Save the converted model to a .tflite file
tflite_path = r'\models\model.tflite' with open(tflite_path, 'wb') as f: f.write(tflite_model)`