tensorflow / text

Making text a first-class citizen in TensorFlow.
https://www.tensorflow.org/beta/tutorials/tensorflow_text/intro
Apache License 2.0
1.21k stars 333 forks source link

classify_text_with_bert Setup failing #1213

Closed fbernaly closed 10 months ago

fbernaly commented 10 months ago

I am running this notebook: https://github.com/tensorflow/text/blob/master/docs/tutorials/classify_text_with_bert.ipynb in Colab: https://colab.research.google.com/github/tensorflow/text/blob/master/docs/tutorials/classify_text_with_bert.ipynb

But I cannot pass the setup:

!pip install "tf-models-official==2.13.*" 

It is failing and I am getting:

Collecting tf-models-official==2.13.*
  Using cached tf_models_official-2.13.1-py2.py3-none-any.whl (2.6 MB)
Requirement already satisfied: Cython in /usr/local/lib/python3.10/dist-packages (from tf-models-official==2.13.*) (3.0.2)
Requirement already satisfied: Pillow in /usr/local/lib/python3.10/dist-packages (from tf-models-official==2.13.*) (9.4.0)
Requirement already satisfied: gin-config in /usr/local/lib/python3.10/dist-packages (from tf-models-official==2.13.*) (0.5.0)
Requirement already satisfied: google-api-python-client>=1.6.7 in /usr/local/lib/python3.10/dist-packages (from tf-models-official==2.13.*) (2.84.0)
Collecting immutabledict (from tf-models-official==2.13.*)
  Using cached immutabledict-3.0.0-py3-none-any.whl (4.0 kB)
Requirement already satisfied: kaggle>=1.3.9 in /usr/local/lib/python3.10/dist-packages (from tf-models-official==2.13.*) (1.5.16)
Requirement already satisfied: matplotlib in /usr/local/lib/python3.10/dist-packages (from tf-models-official==2.13.*) (3.7.1)
Requirement already satisfied: numpy>=1.20 in /usr/local/lib/python3.10/dist-packages (from tf-models-official==2.13.*) (1.23.5)
Requirement already satisfied: oauth2client in /usr/local/lib/python3.10/dist-packages (from tf-models-official==2.13.*) (4.1.3)
Requirement already satisfied: opencv-python-headless in /usr/local/lib/python3.10/dist-packages (from tf-models-official==2.13.*) (4.8.0.76)
Requirement already satisfied: pandas>=0.22.0 in /usr/local/lib/python3.10/dist-packages (from tf-models-official==2.13.*) (1.5.3)
Requirement already satisfied: psutil>=5.4.3 in /usr/local/lib/python3.10/dist-packages (from tf-models-official==2.13.*) (5.9.5)
Requirement already satisfied: py-cpuinfo>=3.3.0 in /usr/local/lib/python3.10/dist-packages (from tf-models-official==2.13.*) (9.0.0)
Requirement already satisfied: pycocotools in /usr/local/lib/python3.10/dist-packages (from tf-models-official==2.13.*) (2.0.7)
Collecting pyyaml<5.4.0,>=5.1 (from tf-models-official==2.13.*)
  Using cached PyYAML-5.3.1.tar.gz (269 kB)
  error: subprocess-exited-with-error

  × python setup.py egg_info did not run successfully.
  │ exit code: 1
  ╰─> See above for output.

  note: This error originates from a subprocess, and is likely not a problem with pip.
  Preparing metadata (setup.py) ... error
error: metadata-generation-failed

× Encountered error while generating package metadata.
╰─> See above for output.

note: This is an issue with the package mentioned above, not pip.
hint: See above for details.

Any idea how can I pass that and move forward?

Because the dependency is not installed, when I run the imports:

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')

I am getting:

---------------------------------------------------------------------------
ModuleNotFoundError                       Traceback (most recent call last)
[<ipython-input-15-805c28e28fd5>](https://localhost:8080/#) 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 plt

ModuleNotFoundError: 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.
---------------------------------------------------------------------------

Here is a video I recorded of what I am doing, let me know if I need to change something: https://youtu.be/gPNpxMvpJts

MrDBC commented 10 months ago

is there some way not to install pyyaml while installing: !pip install "tf-models-official==2.13.*"

im stuck at the same problem it was working a few days ago, just fine

MrDBC commented 10 months ago

i did this and its running perfectly fine: just add ### --no-deps at the end

!pip install "tf-models-official==2.13.*" --no-deps

fbernaly commented 10 months ago

Thank you very much @MrDBC , that works.