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

持续更新中......

相关推荐
W_326001 天前
Python-OpenCV:库、环境搭建、图片与摄像头解析
开发语言·图像处理·python·opencv·机器学习
微学AI1 天前
把时间序列真正用起来:TimechoAI 使用与时序分析实战
数据库·人工智能·大模型
抓不住时间的沙1 天前
N1搭建Hexo个人博客,部署到Github
python·docker·node.js·debian·github·arm
W_326001 天前
Python-OpenCV:画布、图形、文字、调色滑动条
图像处理·python·opencv·机器学习·计算机视觉
GEO_youxuan1 天前
AI财务分析软件到底是“自动出表“还是“决策推演“?从自动出表到决策推演的能力分层与选型逻辑
大数据·人工智能
Promising_GEO1 天前
新电脑科研环境配置指南:Miniforge + PyCharm + GitHub 从安装到可用
ide·python·pycharm·github·地理
IT_陈寒1 天前
Vite的热更新突然失效,原来我忽略了这个配置
前端·人工智能·后端
怪奇云呼军1 天前
闪电智能VoiceAgent 如何管理呼入、接听、桥接和挂断状态?
java·前端·网络·数据库·人工智能
云浪1 天前
Milvus + RAG 实战:《红楼梦》问答助手
前端·人工智能·后端
空堂与归1 天前
机器学习如何入门?AI/ML/DL概念与建模流程全景
人工智能·机器学习