title: How to reload a TensorFlow model with TextVectorization with vocabulary?
body: <p>I have a TensorFlow model with the following structure:</p>
  <pre class="lang-py prettyprint-override"><code>model = keras.Sequential()
  model.add(keras.Input(shape=(), dtype=tf.string))
  model.add(layers.TextVectorization(vocabulary=VOCAB_PATH, output_sequence_length=SEQ_LENGTH))
  model.add(layers.Embedding(VOCAB_SIZE, SEQ_LENGTH))
  model.add(layers.LSTM(SEQ_LENGTH, return_sequences=True))
  model.add(layers.LSTM(SEQ_LENGTH, retrun_sequences=True))
  model.add(layers.Dropout(0.2))
  model.add(layers.Dense(SEQ_LENGTH, activation=&quot;relu&quot;))
  model.add(layers.Dense(SEQ_LENGTH, activation=&quot;relu&quot;))
  model.add(layers.Flatten())
  model.add(layers.Dense(NUM_CLASSES, activation=&quot;softmax&quot;))
  </code></pre>
  <p>After training I save the model with <code>model.save(SAVE_PATH)</code>.</p>
  <p><code>VOCAB_PATH</code> is the path to a text file containing all the words of my corpus. I created it with the <code>get_vocabulary()</code> function of another <code>TextVectorization</code> instance after I adapted it to the corpus. I choose this approach because I want the model to be as self contained as possible. As you can see, I am feeding a string into the model without preprocessing except lower casing and removing special characters.</p>
  <p>But when I reload the model with <code>keras.models.load_model(SAVE_PATH)</code> the following error occurs:</p>
  <pre><code>AssertionError: Some Python objects were not bound to checkpointed values, likely due to changes in the Python program: [&lt;tensorflow.python.ops.lookup_ops.MutableHashTable object at 0x7069027dbe0&gt;]
  WARNING:tensorflow:Unresolved object in checkpoint: (root).layer-0._index_look_layer.lookup_table._initializer._filename
  WARNING:tensorflow:A checkpoint was restored (e.g. tf.train.Checkpoint.restore or tf.keras.Model.load_weights) but not all checkpointed values were used. See above for specific issues.
  </code></pre>
  <p>How do I have to save the model so that I just need to transfer the model and vocabulary files and use it out of the box?</p>