Some keras-nlp (keras 3) colabs stopped working
If I "Run all" the Pretraining a Transformer from scratch with KerasNLP notebook in Colab, it fails at line: tokenizer = keras_nlp.tokenizers.WordPieceTokenizer with the following error:
ImportError: WordPieceTokenizer requires the `tensorflow-text` package. Please install with `pip install tensorflow-text`.
No modifications are done in the notebook.
Installing the tensorflow-text package does not resolve the issue, since it moves to Keras 2.
I notice the same error in other tutorials, like this one Any suggestions would be apreciated.
Thanks
@rafaelsf80 thanks for filing!
For now, pip install tf-keras and this error will go away. The tf-keras package won't even be used, it is purely to work around a temporary issue with the tensorflow-hub package.
The full issue in all it's gory details...
- We try to keep
keras_nlpimportable without tf-text, and catch anImportErrorto check if we found the library. This is to keep the package runnable on things like macos, where tf-text is not available. - Tensorflow text depends on tensorflow hub.
- Tensorflow hub recently made a release that does not have all the correct dependencies and will fail to import with an
ImportError.
There should be a new release of tensorflow hub in a couple days that fixes this issue entirely. If there's any delays will post back here.
Thanks for the answer and explanation. That solves the issue.
Should have closed the a bit ago. tensorflow hub has re-released, this is fixed.