Text Generation WebUI runs on PyTorch, and a CUDA error usually means the installed torch build does not match the GPU or the CUDA drivers. The fix is to check the GPU, confirm the torch build, and reinstall the right one. This guide works through the checks in order.
Before you start
- Text Generation WebUI installed, with an NVIDIA GPU.
- A terminal, and pip or the update wizard.
- A few minutes for a torch reinstall.
See the exact error
Start the WebUI from a terminal and read the error line. “CUDA out of memory” means the model does not fit, which is a different fix from “CUDA not available” or a library load error, which means torch cannot see the GPU at all. Note the exact words before changing anything.
Check the GPU and the torch build
Check the card and the torch build:
nvidia-smi
python -c "import torch; print(torch.cuda.is_available())"
If the first command works and the second prints False, torch was installed without CUDA support, which is the usual cause.
Reinstall torch with CUDA support
Reinstall the torch build that matches your CUDA version, following the install instructions for your platform, then run the WebUI’s update wizard or restart the app. If the error is out of memory instead, load a smaller model or a smaller quantization, and check that no other program is using the GPU.
Worked example
Worked example: the WebUI fails with “CUDA not available” although nvidia-smi shows the card. After reinstalling torch with CUDA support, the check prints True and the WebUI loads a 7B model. If it then fails with out of memory, switch to a 4-bit model or a smaller context.
Expected result
UNTESTED in this guide: no WebUI was run while writing it. The expected result is that torch reports CUDA available, and the WebUI loads the model.
Limitations
Reinstalling torch can take a while and uses several gigabytes of disk. Do not reinstall it for an out-of-memory error: that error means the model is too large, not that torch is broken.
