当在一个工作的cuda环境中训练一些模型时,你可能会遇到错误 RuntimeError: CUDA error: CUBLAS_STATUS_INVALID_VALUE when calling cublasSgemm( handle, opa, opb, m, n, k, &alpha, a, lda, b, ldb, &beta, c, ldc)
这是什么意思以及如何解决?
当在一个工作的cuda环境中训练一些模型时,你可能会遇到错误 RuntimeError: CUDA error: CUBLAS_STATUS_INVALID_VALUE when calling cublasSgemm( handle, opa, opb, m, n, k, &alpha, a, lda, b, ldb, &beta, c, ldc)
这是什么意思以及如何解决?
这可能是一个形状错误报告不完整的问题:
例如,在将x.shape == [a, b]
输入到nn.Linear(c, c, bias=False)
时,如果c的形状与x不匹配,就会出现维度不匹配的错误。此错误消息将显示。
请参见PyTorch论坛的对话。
在使用fairseq时,我遇到了这个错误。我在Amazon Linux 2上安装的CUDA版本是11.5,torch版本是1.13.1。我通过卸载并安装版本1.12.1来解决了这个错误。
后来,我也尝试了这种方式安装torch和cuda,它也运行良好: pip install torch==1.13.1+cu116 --extra-index-url https://download.pytorch.org/whl/cu116