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

持续更新中......

相关推荐
ZeroNews内网穿透1 天前
Dify AI 结合ZeroNews 实现公网快速访问
网络·人工智能·网络协议·tcp/ip·安全·web安全
测试老哥1 天前
UI自动化测试—Jenkins配置优化
自动化测试·软件测试·python·测试工具·ui·jenkins·测试用例
用户307140958481 天前
📢 深度解析 Dify 核心 LLM 提示模板库,揭秘 AI 交互的「幕后魔法」
人工智能·llm·agent
ljh5746491191 天前
大数据geo是什么意思
大数据·人工智能
曲幽1 天前
Python包管理告别龟速下载:uv工具国内镜像与离线安装实战
python·conda·pip·uv·venv·uvx
Katecat996631 天前
卡簧目标检测基于改进YOLO11-C3k2-Star模型的实现
人工智能·目标检测·计算机视觉
点我头像干啥1 天前
机器学习算法之动量法:优化梯度下降的“惯性”策略
人工智能·神经网络·算法·机器学习
珠海西格电力1 天前
零碳园区应急能源基础架构规划:备用电源与清洁能源联动配置
大数据·运维·人工智能·物联网·能源
说私域1 天前
技术驱动下的营销运营革命:开源AI大模型AI智能名片商城系统的实践与启示
人工智能·开源
Elastic 中国社区官方博客1 天前
开始使用 Elastic Agent Builder 和 Strands Agents SDK
大数据·人工智能·elasticsearch·搜索引擎·ai·全文检索