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

@@ -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;