kaldi训练mobvoihotwords报错:
如下截图:终端报错提示在,报错信息被记录在exp/chain/tdnn_1a/log/train.1.1.log里面,于是找到log文件,打开发现有如下报错,报错是说gpu不够用。报错里面也给出了解决报错的建议。
ERROR (nnet3-chain-train[5.5]:AllocateNewRegion():cu-allocator.cc:491)
Failed to allocate a memory region of 8388608 bytes. Possibly this is
due to sharing the GPU. Try switching the GPUs to exclusive mode
(nvidia-smi -c 3) and using the option –use-gpu=wait to scripts like
steps/nnet3/chain/train.py. Memory info: free:14M, used:1985M,
total:2000M, free/total:0.00740509 CUDA error: ‘out of memory’
解决办法如下:(亲测有效)
因为报错是在运行run.sh的第13个步骤(如下图)时出现的
1.修改GPU模式:
sudo nvidia-smi -c 3
要加sudo,不然会报错。
运行成功截图如下:
注意!这个命令的效果在每一次关机后就失效了。所以在下次开机的时候,还需要再次执行命令使其生效。
2.修改local/chain/run_tdnn.sh
把--use-gpu=true \
设置成 --use-gpu=wait \
注意,这里修改不要加注释!因为–use-gpu=wait `是要传的参数,添加注释之后,会有其他的报错,导致不能正常运行。
然后重新运行run.sh脚本。
问题解决啦!
补充:查看ubuntu实时的gpu使用情况,-n 后面接的数字是终端刷新一次间隔的秒数。
watch -n 1 nvidia-smi
or
watch -n 0.1 nvidia-smi
补充:当-use-gpu wait会怎么样?use-gpu 取值true或者wait的不同
在2个GPU的情况,并发数为3,那么只会使用其中1个GPU,当第一个任务使用GPU,其他的两个任务在等待。另外一个GPU被另外的计算进程占用了,因为计算模式设置为Exclusive Process,所以不让其他计算进程使用。
感谢以下链接的帮助:
https://www.pianshen.com/article/84721873090/
https://blog.csdn.net/boyStray/article/details/89046837