关于使用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

持续更新中......

相关推荐
Java与AI落地2 分钟前
AI 接口日志脱敏:log-prompt 关掉之后,prompt 里的内网地址怎么删
人工智能
逆光重构4 分钟前
Amazon 类目属性填充实践:为什么 AI 只该填那些真正空着的必填项
人工智能
Sevennn7 分钟前
Tiny Context:轻量读写、带大小约束的 Coding Agent 项目记忆方案
人工智能
Logintern0911 分钟前
langgraph 图编译的聊天机器人
python·langgraph
Thomas.Sir14 分钟前
第026讲:AI模型开发|脏数据 taxonomy:五类噪声的形态与影响:把脏数据分门别类,才谈得上治理
人工智能·ai
武子康14 分钟前
GameEval第一轮先测什么:正常对照、已知故障与未知探索
大数据·数据库·人工智能
天空属于哈夫克334 分钟前
企业微信API赋能智能办公与流程自动化
人工智能·自动化·企业微信
xurileidian1 小时前
第 22 篇 · 边玩边学Python · 双等号与 is 不是一回事
开发语言·python·spring
微三云云仔1 小时前
2026东莞品牌营销排名观察:从传统咨询到GEO,企业如何选对增长伙伴
大数据·人工智能·geo·ai搜索优化·微三云
OxYGC2 小时前
大模型智能体-大模型概述
人工智能·语音识别