April 2, 2026
Attempt with newer software versions
conda create -n tf-text python=3.13.11
Then activate this environment before installing packages!
conda activate tf-text
Then install via pip
pip install tensorflow-text
and
conda install -c conda-forge matplotlib -y
pip install tensorflow_datasets
This gets rid of the Protobuf gencode error, but
still causes the End of sequence error
tensorflow/core/framework/local_rendezvous.cc:407] Local rendezvous is aborting with status: OUT_OF_RANGE: End
of sequence
April 4, 2026
This package configuration lets the example at
https://colab.research.google.com/gist/Venkat6871/fdd5ded66d27bf590c8b3e52f60a5115/68593_tf_2-21-0-rc0-nightly-v.ipynb
run without error:
conda create -n tf-new python=3.13.11
Then activate this environment before installing packages!
conda activate tf-new
pip uninstall tensorflow -y && pip install tf-nightly
The code
print(f"Tensor Flow Version: {tf.__version__}")
will now report
Tensor Flow Version: 2.22.0-dev20260404
Both
conda list
pip list
report
tf_nightly 2.22.0.dev20260404
but no tensorflow package.
If I try to run the example
https://www.tensorflow.org/tutorials/load_data/text
python complains:
ModuleNotFoundError: No module named 'tensorflow_text'
When I install tensorflow-text with
pip install tensorflow-text
the command will unfortunately also install tensorflow version 2.20
tensorboard 2.20.0 pypi_0 pypi
and
print(f"Tensor Flow Version: {tf.__version__}")
will report
Tensor Flow Version: 2.20.0
in other words, the tensorflow-text install has ruined the configuration and the End of Sequence error is
back.
Lets try the latest release:
Tensorflow Releases:
https://github.com/tensorflow/tensorflow/releases
conda create -n tf-new python=3.13.11
Then activate this environment before installing packages!
conda activate tf-new
Checking the version:
pip install tensorflow==2.21.0
print(f"Tensor Flow Version: {tf.__version__}")
will report
Tensor Flow Version: 2.21.0
The example at
https://colab.research.google.com/gist/Venkat6871/fdd5ded66d27bf590c8b3e52f60a5115/68593_tf_2-21-0-rc0-nightly-v.ipynb
runs without error.
pip install tensorflow_datasets
will work, but
pip install tensorflow-text
will downgrade tensorflow to version 2.20
and the End of sequence error is back.
Is there an older version of the packages that works?
Note:
https://github.com/tensorflow/text
requests that the same version of tensorflow-text is installed as tensorflow.
Tried Tensorflow 2.18, 2.14, 2.11, 2.10,
None of them worked.
April 13, 2026
The English-Spanish Translation: Transformer example on Kaggle works, except for the saving and loading process
of the model.
The code does not have an explicit save instruction, rather intermediate progress is saved in the
tf.keras.callbacks.ModelCheckpoint callback of the model.fit() call.
When I run the code as is, the checkpoint saving results in a directory named model.tf being created,
however loading the model leads to an error.
The following applies to loading inside the training block
The original combination
filepath="model.tf",
..
transformer.load_weights("model.tf")
leads to an error
tensorflow/core/util/tensor_slice_reader.cc:98] Could not open model.tf: FAILED_PRECONDITION: model.tf; Is a
directory: perhaps your file is in a different file format and you need to use a different restore operator?
The combination
filepath="model.tf",
..
transformer.load_model("model.tf")
leads to an error
AttributeError: 'Functional' object has no attribute 'load_model'
The API documentation of tf.keras.callbacks.ModelCheckpoint at
https://www.tensorflow.org/api_docs/python/tf/keras/callbacks/ModelCheckpoint
mentions only files for saving weights or the model, but not a folder:
- weights.h5 for saving weights only
- model.keras for saving the whole model.
The combination
filepath="model.keras",
..
transformer.load_model("model.keras")
leads to an error
AttributeError: 'Functional' object has no attribute 'load_model'
The combination
filepath="model.keras",
..
transformer.load_weights("model.keras")
works, and the translation is successful.
April 14, 2026
The transformer can also be saved explicitly, outside of the checkpoint callback.
transformer.save("model.keras")
However, loading the transformer
transformer.load_model("model.keras")
leads to the error
TypeError: Cannot deserialize object of type `PositionalEmbedding`. If `PositionalEmbedding` is a custom
class, please register it using the `@keras.saving.register_keras_serializable()` decorator.
This problem can be solved by declaring the classes
transformer = load_model(
checkpoint_filepath,
custom_objects={
"PositionalEmbedding": PositionalEmbedding,
"TransformerEncoder": TransformerEncoder,
"TransformerDecoder": TransformerDecoder,
}
)
"save and load keras transformer model"
https://stackoverflow.com/questions/78396871/save-and-load-keras-transformer-model
April 17, 2026
When loading the transformer that was trained with English-Spanish language data, it is necesseray to provide
the vocabulary with which the transformer was trained to the code.
This can be done by using the same steps in the training for the original input data:
- load into Pandas dataframe
- strip punctuation characters
- standardize
- TextVectorization
- adapt