I am using Colab, I am trying to import SentenceTransformer:
from sentence_transformers import SentenceTransformer
However, I got this error:
ttributeError Traceback (most recent call last)
/usr/local/lib/python3.10/dist-packages/transformers/utils/import_utils.py in _get_module(self, module_name)
1566 try:
-> 1567 return importlib.import_module(“.” + module_name, self.name)
1568 except Exception as e:
41 frames
AttributeError: module ‘tensorflow._api.v2.compat.v2.internal‘ has no attribute ‘register_load_context_function’
The above exception was the direct cause of the following exception:
RuntimeError Traceback (most recent call last)
RuntimeError: Failed to import transformers.modeling_tf_utils because of the following error (look up to see its traceback):
module ‘tensorflow._api.v2.compat.v2.internal‘ has no attribute ‘register_load_context_function’
The above exception was the direct cause of the following exception:
RuntimeError Traceback (most recent call last)
/usr/local/lib/python3.10/dist-packages/transformers/utils/import_utils.py in _get_module(self, module_name)
1567 return importlib.import_module(“.” + module_name, self.name)
1568 except Exception as e:
-> 1569 raise RuntimeError(
1570 f”Failed to import {self.name}.{module_name} because of the following error (look up to see its”
1571 f” traceback):n{e}”
RuntimeError: Failed to import transformers.integrations.integration_utils because of the following error (look up to see its traceback):
Failed to import transformers.modeling_tf_utils because of the following error (look up to see its traceback):
module ‘tensorflow._api.v2.compat.v2.internal‘ has no attribute ‘register_load_context_function’
I tried reinstalling TensorFlow, transformers, sentence-transformers but it didnt work. I have no idea how to resolve this problem
I expected to get successful import