I am trying to import tensorflow text into google colab, but it is not working. I first used the cell
!pip install tensorflow-text
and got a message saying that it had been installed correctly, however when I run the cell:
import tensorflow_text as text
I get the error
---------------------------------------------------------------------------
ModuleNotFoundError Traceback (most recent call last)
Input In [2], in <cell line: 1>()
----> 1 import tensorflow_text as text
ModuleNotFoundError: No module named 'tensorflow_text'
How do i solve this? I cannot understand why colab does not register it as a library. I have also tried re-hosting the session on my computer and installing tf text on there, but it still gives the module not found error. Does anyone know a solution?
I ran into this same problem. I had two issues first I overlooked that one small line at the very top, above the imports, of the Tensorflow code example. Silly mistake, but it happens... Second, it appears Google Colab currently has some compatibility issues with certain versions of tensorflow-text. I resolved that issue by requiring it to load v2.8.
Solution: Install tensorflow-text version 2.8
!pip3 install --quiet "tensorflow-text==2.8.*"
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With