关于使用tensorflow_gpu遇到的问题

前言

我使用的是tensorflow_gpu2.6与python3.9,还要下载cuda与cudnn。

numpy版本问题

AttributeError: module 'numpy' has no attribute 'object'. np.object was a deprecated alias for the builtin object. To avoid this error in existing code, use object 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:

  1. Downgrade the protobuf package to 3.20.x or lower.
  2. 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

持续更新中......

相关推荐
yiyu071621 小时前
3分钟搞懂深度学习AI:实操篇:池化层
人工智能·深度学习
亚马逊云开发者1 天前
5 分钟用 Amazon Bedrock 搭一个 AI Agent:从零到能干活
人工智能·agent·amazon
小兵张健1 天前
白嫖党的至暗时期
人工智能·chatgpt·aigc
IT_陈寒1 天前
SpringBoot项目启动慢?5个技巧让你的应用秒级响应!
前端·人工智能·后端
用户8356290780511 天前
使用 C# 在 Excel 中创建数据透视表
后端·python
小徐_23331 天前
向日葵 x AI:把远程控制封装成 MCP,让 AI 替我远程控制设备
前端·人工智能
桦说编程1 天前
Harness Engineering — AI 时代的工程最佳实践
人工智能·架构·代码规范
老纪的技术唠嗑局1 天前
Agent / Skills / Teams 架构演进流程及技术选型之道
人工智能·agent
该用户已不存在1 天前
除了OpenClaw还有谁?五款安全且高效的开源AI智能体
人工智能·aigc·ai编程