解决kaldi训练报错 CUDA error: ‘out of memory‘,gpu不够用(亲测有效)

kaldi训练mobvoihotwords报错:

解决kaldi训练报错 CUDA error: ‘out of memory‘,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个步骤(如下图)时出现的

解决kaldi训练报错 CUDA error: ‘out of memory‘,gpu不够用(亲测有效)

; 1.修改GPU模式:

sudo nvidia-smi -c 3

要加sudo,不然会报错。
运行成功截图如下:

解决kaldi训练报错 CUDA error: ‘out of memory‘,gpu不够用(亲测有效)

2.修改local/chain/run_tdnn.sh

--use-gpu=true \
设置成 --use-gpu=wait \
注意,这里修改不要加注释!因为–use-gpu=wait `是要传的参数,添加注释之后,会有其他的报错,导致不能正常运行。
然后重新运行run.sh脚本。

问题解决啦!

解决kaldi训练报错 CUDA error: ‘out of memory‘,gpu不够用(亲测有效)

; 补充:查看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

Original: https://blog.csdn.net/qq_43744723/article/details/119183173
Author: 关彼得
Title: 解决kaldi训练报错 CUDA error: ‘out of memory‘,gpu不够用(亲测有效)

原创文章受到原创版权保护。转载请注明出处:https://www.johngo689.com/515589/

转载文章受原作者版权保护。转载请注明原作者出处!

(0)

大家都在看

亲爱的 Coder【最近整理,可免费获取】👉 最新必读书单  | 👏 面试题下载  | 🌎 免费的AI知识星球