Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ImportError: TFBertForSequenceClassification requires the TensorFlow library but it was not found in your environment. #2

Open
ankitadhar opened this issue May 8, 2021 · 2 comments

Comments

@ankitadhar
Copy link

Even though tensorflow is installed as can be seen below:

python -c 'import tensorflow as tf; print(tf.__version__)' 2.4.0-rc0
upon running following:
python dump_tf_graph.py
I am getting error that tensorflow library is not found.

Traceback (most recent call last): File "dump_tf_graph.py", line 25, in <module> main() File "/Users/ankitadhar/miniforge3/envs/tf_env/lib/python3.8/site-packages/click/core.py", line 829, in __call__ return self.main(*args, **kwargs) File "/Users/ankitadhar/miniforge3/envs/tf_env/lib/python3.8/site-packages/click/core.py", line 782, in main rv = self.invoke(ctx) File "/Users/ankitadhar/miniforge3/envs/tf_env/lib/python3.8/site-packages/click/core.py", line 1066, in invoke return ctx.invoke(self.callback, **ctx.params) File "/Users/ankitadhar/miniforge3/envs/tf_env/lib/python3.8/site-packages/click/core.py", line 610, in invoke return callback(*args, **kwargs) File "dump_tf_graph.py", line 19, in main model = tf_utils.get_huggingface_model(model_name, batch_size, seq_len) File "/Users/ankitadhar/Documents/NLP/worksheet/git-bert/Apple-M1-BERT/tf_utils.py", line 40, in get_huggingface_model model = _load_keras_model( File "/Users/ankitadhar/Documents/NLP/worksheet/git-bert/Apple-M1-BERT/tf_utils.py", line 21, in _load_keras_model model = module.from_pretrained(name) File "/Users/ankitadhar/miniforge3/envs/tf_env/lib/python3.8/site-packages/transformers/utils/dummy_tf_objects.py", line 372, in from_pretrained requires_tf(self) File "/Users/ankitadhar/miniforge3/envs/tf_env/lib/python3.8/site-packages/transformers/file_utils.py", line 550, in requires_tf raise ImportError(TENSORFLOW_IMPORT_ERROR.format(name)) ImportError: TFBertForSequenceClassification requires the TensorFlow library but it was not found in your environment. Checkout the instructions on the installation page: https://www.tensorflow.org/install and follow the ones that match your environment.

@ElliotQi
Copy link

Have the same issue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants