improve error messages

This commit is contained in:
josc146 2023-06-23 16:32:05 +08:00
parent 97f6af595e
commit 7f2f4f15c1
2 changed files with 6 additions and 4 deletions

View File

@ -159,8 +159,9 @@
"Delete": "删除",
"Edit": "编辑",
"Memory is not enough, try to increase the virtual memory or use a smaller model.": "内存不足,尝试增加虚拟内存,或使用一个更小规模的模型",
"Bad pytorch version, please reinstall pytorch with cuda.": "错误的Pytorch版本请重新安装CUDA版本的Pytorch",
"Bad PyTorch version, please reinstall PyTorch with cuda.": "错误的PyTorch版本请重新安装CUDA版本的PyTorch",
"The model file is corrupted, please download again.": "模型文件损坏,请重新下载",
"Found no NVIDIA driver, please install the latest driver.": "没有找到NVIDIA驱动请安装最新驱动",
"VRAM is not enough, please reduce stored layers or use a lower precision in Configs page.": "显存不足,请在配置页面减少载入显存层数,或使用更低的精度"
"VRAM is not enough, please reduce stored layers or use a lower precision in Configs page.": "显存不足,请在配置页面减少载入显存层数,或使用更低的精度",
"Failed to enable custom CUDA kernel, ninja is required to load C++ extensions. You may be using the CPU version of PyTorch, please reinstall PyTorch with CUDA. Or if you are using a custom Python interpreter, you must compile the CUDA kernel by yourself or disable Custom CUDA kernel acceleration.": "自定义CUDA算子开启失败需要安装Ninja来读取C++扩展。你可能正在使用CPU版本的PyTorch请重新安装CUDA版本的PyTorch。如果你正在使用自定义Python解释器你必须自己编译CUDA算子或禁用自定义CUDA算子加速"
}

View File

@ -210,10 +210,11 @@ export const RunButton: FC<{ onClickRun?: MouseEventHandler, iconMode?: boolean
const error = await r.text();
const errorsMap = {
'not enough memory': 'Memory is not enough, try to increase the virtual memory or use a smaller model.',
'not compiled with CUDA': 'Bad pytorch version, please reinstall pytorch with cuda.',
'not compiled with CUDA': 'Bad PyTorch version, please reinstall PyTorch with cuda.',
'invalid header or archive is corrupted': 'The model file is corrupted, please download again.',
'no NVIDIA driver': 'Found no NVIDIA driver, please install the latest driver.',
'CUDA out of memory': 'VRAM is not enough, please reduce stored layers or use a lower precision in Configs page.'
'CUDA out of memory': 'VRAM is not enough, please reduce stored layers or use a lower precision in Configs page.',
'Ninja is required to load C++ extensions': 'Failed to enable custom CUDA kernel, ninja is required to load C++ extensions. You may be using the CPU version of PyTorch, please reinstall PyTorch with CUDA. Or if you are using a custom Python interpreter, you must compile the CUDA kernel by yourself or disable Custom CUDA kernel acceleration.'
};
const matchedError = Object.entries(errorsMap).find(([key, _]) => error.includes(key));
const message = matchedError ? t(matchedError[1]) : error;