前言
我使用的是tensorflow_gpu2.6与python3.9,还要下载cuda与cudnn。
numpy版本问题
AttributeError: module 'numpy' has no attribute 'object'.
np.object
was a deprecated alias for the builtinobject
. To avoid this error in existing code, useobject
by itself. Doing this will not modify any behavior and is safe.
解决方法:
下载高一些版本或低一些的版本,tensorfolw2.6适配的时1.20以上
pip install numpy==1.21
protobuf版本问题
TypeError: Descriptors cannot be created directly. If this call came from a _pb2.py file, your generated code is out of date and must be regenerated with protoc >= 3.19.0. If you cannot immediately regenerate your protos, some other possible workarounds are:
- Downgrade the protobuf package to 3.20.x or lower.
- Set PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION=python (but this will use pure-Python parsing and will be much slower).
解决方法:
保持protobuf的版本在3.19到3.20之间
pip install protobuf==3.19
keras版本问题
from tensorflow.compat.v2.experimental import dtensor as dtensor_api ImportError: cannot import name 'dtensor' from 'tensorflow.compat.v2.experimental'
解决方法:
keras的版本要与tensorflow最好保持一致
pip install keras==2.6
持续更新中……