訓練BiLSTM模型的時候報錯:
InternalError (see above for traceback): Blas GEMM launch failed : a.shape=(32, 200), b.shape=(200, 400), m=32, n=400, k=200 [[node bilstm_crf/bidirectional_rnn/fw/fw/while/lstm_cell/MatMul (defined at train-nxf.py:48) ]] [[node bilstm_crf/rnn_2/while/Switch_2 (defined at train-nxf.py:69) ]]
解決方法:
如果你是使用 GPU 版 TensorFlow 的話,並且你想在顯卡高占用率的情況下訓練模型,那你要注意在初始化 Session 的時候為其分配固定數量的顯存,否則可能會在開始訓練的時候直接報錯退出:
這時你需要用下面的方法創建 Session:
gpu_options=tf.GPUOptions(per_process_gpu_memory_fraction=0.333) sess = tf.Session(config=tf.ConfigProto(gpu_options=gpu_options))
參考文獻:
【1】https://blog.csdn.net/orangefly0214/article/details/80978374