线条类网站,怎么在一个网站做编辑,爱站网站长百度查询权重,深圳专业建站多少钱首先租用新实例#xff08;我选的是3080*2卡#xff09;#xff0c;由于基础镜像中没有2.10.0版本#xff0c;选miniconda3的基础环境 创建虚拟环境#xff1a;conda create --name xxx python3.8#xff08;环境名#xff09;激活虚拟环境#xff1a;conda activate x…首先租用新实例我选的是3080*2卡由于基础镜像中没有2.10.0版本选miniconda3的基础环境 创建虚拟环境conda create --name xxx python3.8环境名激活虚拟环境conda activate xxx我的cuda版本11.3 cudnn版本8.2.0检查cuda版本nvcc --version检查cudnn版本dpkg-query -l | grep libcudnn
pip install tensorflow-gpu2.10
完成安装后检查版本信息(依次输入以下代码
pythonimport tensorflow as tftf.__version__(注意是两条小短杠
2.10print(tf.test.is_gpu_available())
Trueprint(Available GPUs:, tf.config.list_physical_devices(GPU))
Available GPUs: [PhysicalDevice(name/physical_device:GPU:0, device_typeGPU)]#显示可用的gpu,,如果显示Available GPUs: []就是没检测到可用的gpu
输出对应版本信息和True才安装成功
exit()退出
我是分割线
①在Noteb0ook里进行测试 ②可以看到和前面差不多的版本信息以及可用的gpu数量
import tensorflow as tfprint(tf.__version__)
print(tf.test.gpu_device_name())
print(tf.config.experimental.set_visible_devices)
print(GPU:, tf.config.list_physical_devices(GPU))
print(CPU:, tf.config.list_physical_devices(device_typeCPU))
print(tf.config.list_physical_devices(GPU))
print(tf.test.is_gpu_available())
# 输出可用的GPU数量
print(Num GPUs Available: , len(tf.config.experimental.list_physical_devices(GPU)))
同样可以看得到版本信息
我是分割线
小测试依次输入
python
import tensorflow as tf
hello tf.constant(Hello, TensorFlow!)
print(hello.numpy())
输出bHello, TensorFlow!
我是分割线
出问题大概是驱动程序、CUDA 库、TensorFlow 版本或环境配置的冲突导致我一般选择更改tensorflow版本
我的经验是gpt比百度别人的经验靠谱别人成功了一样的代码 自己的环境下不一定成功。安装环境就是玄学。