windows10 GPU+tensorflow环境配置

一、安装CUDA和CUDNN

参考这篇博客,完全无坑

基于上面的博客,安装了CUDA10.0

二、安装tensorflow

错误1:from google.protobuf.pyext import _message ImportError: DLL load failed: The specified procedure could not be found.

解决方案:卸载protobuf,并 pip install protobuf==3.6.0

错误2:FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy.......

解决方案:numpy1-17-0版本过高,使用numpy-1.16-0版本即可

错误3: Blas GEMM launch failed  或者

failed to create cublas handle: CUBLAS_STATUS_ALLOC_FAILED

解决方案:原因均为显存不足,添加如下代码

import tensorflow as tf
from keras.backend.tensorflow_backend import set_session
config = tf.compat.v1.ConfigProto()
config.gpu_options.allocator_type = 'BFC' #A "Best-fit with coalescing" algorithm, simplified from a version of dlmalloc.
config.gpu_options.per_process_gpu_memory_fraction = 0.3
config.gpu_options.allow_growth = True
tf.compat.v1.keras.backend.set_session(tf.compat.v1.Session(config=config))

 错误4tensorflow.python.framework.errors_impl.ResourceExhaustedError: OOM when allocating tensor with shape[?]

解决方案:还是显存不足

尝试以下几种措施:

1 减少Batch 的大小

2 分析错误的位置,在哪一层出现显卡不够,比如在全连接层出现的,则降低全连接层的维度,把2048改成1042啥的

3 增加pool 层,降低整个网络的维度。

4 修改输入图片的大小

 

由于当前用的是1050TI显卡,显存只有4G,多次尝试均无法解决显存问题,只能卸载tensorflow-gpu,重新安装了cpu版

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值