Tutorial: Classify text with BERT Cannot install dependencies by pip in Colab
r-matsuzaka opened this issue · 4 comments
Hi, I am now tring to run the Classify text with BERT tutorial in Colab. But I got the following error when I run the cell.
import os
import shutil
import tensorflow as tf
import tensorflow_hub as hub
import tensorflow_text as text
from official.nlp import optimization # to create AdamW optimizer
import matplotlib.pyplot as plt
tf.get_logger().setLevel('ERROR')
ModuleNotFoundError Traceback (most recent call last)
in <cell line: 7>()
5 import tensorflow_hub as hub
6 import tensorflow_text as text
----> 7 from official.nlp import optimization # to create AdamW optimizer
8
9 import matplotlib.pyplot as pltModuleNotFoundError: No module named 'official'
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.
In the previous cell, when I run !pip install -q tf-models-official==2.11.0
I got the following error.
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 118.9/118.9 kB 4.3 MB/s eta 0:00:00 ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 43.6/43.6 kB 3.2 MB/s eta 0:00:00
Preparing metadata (setup.py) ... done
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 1.3/1.3 MB 33.1 MB/s eta 0:00:00
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 240.6/240.6 kB 22.7 MB/s eta 0:00:00
ERROR: Could not find a version that satisfies the requirement opencv-python-headless==4.5.2.52 (from tf-models-official) (from versions: 3.4.10.37, 3.4.11.39, 3.4.11.41, 3.4.11.43, 3.4.11.45, 3.4.13.47, 3.4.15.55, 3.4.16.59, 3.4.17.61, 3.4.17.63, 3.4.18.65, 4.3.0.38, 4.4.0.40, 4.4.0.42, 4.4.0.44, 4.4.0.46, 4.5.1.48, 4.5.3.56, 4.5.4.58, 4.5.4.60, 4.5.5.62, 4.5.5.64, 4.6.0.66, 4.7.0.68, 4.7.0.72)
ERROR: No matching distribution found for opencv-python-headless==4.5.2.52
I could install offcial
by !pip install -q tf-models-official
. But in the next cell I got the other error... Could you tell me the correct instruction to isntall the dependency?
import os
import shutilimport tensorflow as tf
import tensorflow_hub as hub
import tensorflow_text as text
from official.nlp import optimization # to create AdamW optimizerimport matplotlib.pyplot as plt
tf.get_logger().setLevel('ERROR')
AssertionError Traceback (most recent call last)
in <cell line: 7>()
5 import tensorflow_hub as hub
6 import tensorflow_text as text
----> 7 from official.nlp import optimization # to create AdamW optimizer
8
9 import matplotlib.pyplot as plt11 frames
/usr/local/lib/python3.10/dist-packages/tensorflow/python/saved_model/revived_types.py in register_revived_type(identifier, predicate, versions)
131
132 if identifier in _REVIVED_TYPE_REGISTRY:
--> 133 raise AssertionError(f"Duplicate registrations for type '{identifier}'")
134
135 _REVIVED_TYPE_REGISTRY[identifier] = (predicate, versions)AssertionError: Duplicate registrations for type 'experimentalOptimizer'
The reason is the failure of CI
978fd9f
I could run the notebook with the previous versions.
@r-matsuzaka : have you found any workaround?
I encountered the same issue: #1213
@fbernaly
here it is:
#1213 (comment)