tensorflow/text

TextVectorization: Missing support for saving to .h5

extreme4all opened this issue · 1 comments

save_format='tf' gives a folder and is less portable than an .h5
Please support saving to .h5

VOCAB_SIZE = 20_000
encoder = tf.keras.layers.TextVectorization(
    max_tokens=VOCAB_SIZE,
    standardize='lower',
    output_mode='int')
encoder.adapt(train_dataset.map(lambda text, label: text))

The error:

NotImplementedError: Save or restore weights that is not an instance of tf.Variable is not supported in h5, use save_format='tf' instead. Received a model or layer TextVectorization with weights [<keras.layers.preprocessing.index_lookup.VocabWeightHandler object at 0x0000025548A6C6A0>]

This layer is a part of Keras and not TF Text. Can you add this as an issue to it instead of here? Thanks.