Open chinsu70802 opened 6 months ago
Same problem, I downgraded tensorflow to 2.7.4 to solve the problem.
Addendum: 2.7.4 can train the model but cannot execute the prediction code, with 2.8.4 you can train as well as execute the prediction.
Thanks @Jinnrry! It is working now.
Hi!
I am trying to use RetVec as an embedding layer for a email spam classification project. When the RetVecTokenizer function is called, I get a Value Error which is described below:
File format not supported: filepath=/root/.keras/retvec-v1. Keras 3 only supports V3
.keras
files and legacy H5 format files (.h5
extension). Note that the legacy SavedModel format is not supported byload_model()
in Keras 3. In order to reload a TensorFlow SavedModel as an inference-only layer in Keras 3, usekeras.layers.TFSMLayer(/root/.keras/retvec-v1, call_endpoint='serving_default')
(note that yourcall_endpoint
might have a different name).Here is the code I wrote:
inputs = layers.Input(shape=(1, ), name="token", dtype=tf.string)
lstm_1 = tf.keras.layers.LSTM(20, dropout=0.2, return_sequences=True)(x) lstm_2 = tf.keras.layers.LSTM(20, dropout=0.2, return_sequences=True)(lstm_1) flatten = tf.keras.layers.Flatten()(lstm_2) dropout = tf.keras.layers.Dropout(0.2, name="dropout")(flatten) dense = tf.keras.layers.Dense(1, activation="sigmoid")(dropout)
model = tf.keras.Model(inputs=[inputs], outputs=[dense])
How to resolve this?