When we are using transformers, we may get this error: ValueError: tensorflow.__spec__ is None. In this tutorial, we will introduce you how to fix it.
This error looks like:
How to fix this error?
We should update the version of transformers.
As to us,the version is 3.3.0
__version__ = "3.3.0"
We can use pip to upgrade to 4.16.2
pip install --upgrade -i https://mirrors.aliyun.com/pypi/simple/ transformers==4.16.2 --trusted-host mirrors.aliyun.com
Then, we will find this error is fixed.