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

持续更新中......

相关推荐
m4Rk_几秒前
【论文阅读】Agent 记忆机制(63):SAMem——把经验记忆细化为带长期价值的状态—Thought
论文阅读·人工智能·学习·开源·github
龍德明宇几秒前
从「桔槔之诫」到 Vibe Coding:你的控制权正在被偷走-龍德明宇
人工智能·大语言模型llm·vibe coding·负主体性·ai存在论
飞哥数智坊3 分钟前
周末薅 Token 羊毛,没想到 ZCode 已经把开发和测试打通了
人工智能·ai编程
matlab代码5 分钟前
matlab车牌出入库识别系统停车场演示【源码61期】
人工智能·计算机视觉
华研前沿标杆游学8 分钟前
走进字节豆包参观游学考察
python
醍醐实验室9 分钟前
测试时搜索 vs 采样扩展:Pass@k 与 Majority Voting 的效率边界
人工智能
hyunbar77713 分钟前
腾讯云 Ubuntu 24.04上通过 Docker 部署 PostgreSQL
人工智能
向哆哆15 分钟前
鸡行为目标检测数据集:3类别 | 目标检测
人工智能·目标检测·计算机视觉
MindUp20 分钟前
免费AI工具实测:3款编程与办公辅助方案对比(2026)
人工智能
XIANGCHU88821 分钟前
市场周刊| 促进中小企业发展“十五五”规划发布 推进残疾学生职业教育和就业衔接发展
人工智能