项目场景:
一个命名实体识别模型,BERT+BiGRU+CRF。
问题描述:
在以前的笔记本上面,显卡2060,python3.7,tensorflow1.13,cuda10.0,cudnn7.4一直运行无错。
把模型弄到台式机上面来,3060显卡,装了python3.7,tensorflw1.13,cuda10.0,cudnn7.4,显示以下错误:
failed to run cuBLAS routine cublasSgemm_v2: CUBLAS_STATUS_EXECUTION_FAILED
Traceback (most recent call last):
tensorflow.python.framework.errors_impl.InternalError: Blas GEMM launch failed : a.shape=(1536, 2), b.shape=(2, 768), m=1536, n=768, k=2
[[{{node bert/embeddings/MatMul}}]]
[[{{node crf_loss/Mean}}]]
原因分析:
网上解决方案没用,包括
①:设置显存
import os
os.environ["CUDA_VISIBLE_DEVICES"] = '0' #use GPU with ID=0
config = tf.ConfigProto()
config.gpu_options.per_process_gpu_memory_fraction = 0.5 # maximun alloc gpu50% of MEM
# config.gpu_options.allow_growth = True #allocate dynamically
③显存占用,关闭其他占用显存程序
②重启
解决方案:
原因其实很简单,3060等30系显卡不支持cuda11以下版本,等死吧你