google-research/text-to-text-transfer-transformer

Can't import T5 module in Colab

yhong4 opened this issue · 3 comments

Hi team,
I'm trying to install t5 in colab with pip3

!pip3 install t5
!pip3 install tensorflow

But when I import

import t5

I got importError

ImportError                               Traceback (most recent call last)
[<ipython-input-2-42ca30221abe>](https://localhost:8080/#) in <module>()
----> 1 import t5

6 frames
[/usr/local/lib/python3.7/dist-packages/tensorflow_text/__init__.py](https://localhost:8080/#) in <module>()
     18 
     19 # pylint: disable=wildcard-import
---> 20 from tensorflow_text.core.pybinds import tflite_registrar
     21 from tensorflow_text.python import keras
     22 from tensorflow_text.python import metrics

ImportError: /usr/local/lib/python3.7/dist-packages/tensorflow_text/core/pybinds/tflite_registrar.so: undefined symbol: _ZN4absl12lts_2021110220raw_logging_internal21internal_log_functionB5cxx11E

---------------------------------------------------------------------------
NOTE: If your import is failing due to a missing package, you can
manually install dependencies using either !pip or !apt.

To view examples of installing some common dependencies, click the
"Open Examples" button below.

Any solution to it?
Thanks in advance

---------------------------------------------------------------------------
ImportError                               Traceback (most recent call last)
[<ipython-input-3-cc9017ad3556>](https://localhost:8080/#) in <module>()
     28 # tf.enable_eager_execution()
     29 import tensorflow_datasets as tfds
---> 30 import t5
     31 
     32 #Set the base dir(Google cloud bucket)

6 frames
[/usr/local/lib/python3.7/dist-packages/t5/__init__.py](https://localhost:8080/#) in <module>()
     15 """Import API modules."""
     16 
---> 17 import t5.data
     18 import t5.evaluation
     19 

[/usr/local/lib/python3.7/dist-packages/t5/data/__init__.py](https://localhost:8080/#) in <module>()
     15 """Import data modules."""
     16 # pylint:disable=wildcard-import,g-bad-import-order
---> 17 from t5.data.dataset_providers import *
     18 from t5.data.glue_utils import *
     19 import t5.data.postprocessors

[/usr/local/lib/python3.7/dist-packages/t5/data/dataset_providers.py](https://localhost:8080/#) in <module>()
     26 import re
     27 
---> 28 import seqio
     29 from t5.data import utils
     30 import tensorflow.compat.v2 as tf

[/usr/local/lib/python3.7/dist-packages/seqio/__init__.py](https://localhost:8080/#) in <module>()
     16 # pylint:disable=wildcard-import,g-bad-import-order
     17 
---> 18 from seqio.dataset_providers import *
     19 from seqio import evaluation
     20 from seqio import experimental

[/usr/local/lib/python3.7/dist-packages/seqio/dataset_providers.py](https://localhost:8080/#) in <module>()
     34 from seqio import utils
     35 from seqio.feature_converters import FeatureConverter
---> 36 from seqio.vocabularies import PassThroughVocabulary
     37 from seqio.vocabularies import Vocabulary
     38 import tensorflow.compat.v2 as tf

[/usr/local/lib/python3.7/dist-packages/seqio/vocabularies.py](https://localhost:8080/#) in <module>()
     21 from absl import logging
     22 import tensorflow.compat.v2 as tf
---> 23 import tensorflow_text as tf_text
     24 
     25 from sentencepiece import sentencepiece_model_pb2

[/usr/local/lib/python3.7/dist-packages/tensorflow_text/__init__.py](https://localhost:8080/#) in <module>()
     18 
     19 # pylint: disable=wildcard-import
---> 20 from tensorflow_text.core.pybinds import tflite_registrar
     21 from tensorflow_text.python import keras
     22 from tensorflow_text.python import metrics

ImportError: /usr/local/lib/python3.7/dist-packages/tensorflow_text/core/pybinds/tflite_registrar.so: undefined symbol: _ZN4absl12lts_2021110220raw_logging_internal21internal_log_functionB5cxx11E

---------------------------------------------------------------------------
NOTE: If your import is failing due to a missing package, you can
manually install dependencies using either !pip or !apt.

To view examples of installing some common dependencies, click the
"Open Examples" button below.
---------------------------------------------------------------------------

Hi,
I solved the issue by installing an older version of tensorflow-text.
Try !pip install -q tensorflow-text==2.8.0rc0

@ferrava Thanks. It works like a charm.