PyTorch – explained simply
PyTorch is the compute library that most image, video, and audio AIs are built on; it brings the models to your graphics card.
Also: torch, torchvision, torchaudio
PyTorch does the actual computing work: It loads a model’s weights and runs the calculations on the CPU or GPU. Tools like ComfyUI are basically interfaces that control PyTorch.
PyTorch comes in several variants: for different CUDA versions (Nvidia), for ROCm (AMD), and CPU-only. The selection page on pytorch.org generates the right install command. The current stable version requires at least Python 3.10.
To check whether the graphics card is recognized, use Python with import torch and then torch.cuda.is_available(). If it returns False, the CPU-only version is usually installed or the driver is too old.
What does that mean for you? If a tool only uses the CPU even though you have an Nvidia card, the wrong PyTorch variant is very often installed.
Related terms
Errors where that matters
- A1111/Forge with RTX 50: sm_120 is not compatible
- A1111/Forge: Torch is not able to use GPU
- A1111: INCOMPATIBLE PYTHON VERSION / Couldn't install torch
- AMD Radeon is not being used, PyTorch is running on the CPU
- Chatterbox: Attempting to deserialize object on a CUDA device but torch.cuda.is_available() is False (model wants a graphics card that PyTorch can’t see)
- CUDA gone after installing a custom node or package
- CUDAExecutionProvider is not in available provider names (onnxruntime runs only on the CPU)
- DefaultCPUAllocator: not enough memory: you tried to allocate (RAM full)
- Error loading c10.dll (WinError 126 / 1114)
- expected scalar type Half but found Float (number formats do not match)
- hipErrorNoBinaryForGpu: Unable to find code object for all current devices! (ROCm has no matching code for your AMD card)
- Intel Arc not recognized (torch.xpu)
- module 'torch' has no attribute 'float8_e4m3fn' (PyTorch too old for fp8)
- no kernel image is available (graphics card does not match the PyTorch version)
- No matching distribution found for torch (wrong Python version)
- No module named 'sageattention' (starting with --use-sage-attention fails)
- No module named 'triton' on Windows (triton-windows missing)
- OSError: [WinError 1455] The paging file is too small for this operation to complete (Windows paging file is too small)
- OSError: CUDA_HOME environment variable is not set (CUDA toolkit with nvcc is missing during compilation)
- RuntimeError: CUDA error: an illegal memory access was encountered – the graphics card accessed invalid memory
- RuntimeError: No CUDA GPUs are available (PyTorch does not see a usable NVIDIA graphics card)
- Stable diffusion model failed to load (model can’t be loaded — the real cause is above)
- SwarmUI: Torch not compiled with CUDA enabled
- The NVIDIA driver on your system is too old
- Torch not compiled with CUDA enabled
- torch._scaled_mm is only supported on CUDA devices with compute capability >= 9.0 or 8.9 (fp8 fast mode needs RTX 40 or newer)
- UserWarning: FP16 is not supported on CPU; using FP32 instead (Whisper is running on the processor instead of the graphics card)
- UserWarning: Torch was not compiled with flash attention – usually harmless on Windows
- Weights only load failed / Unsupported global (PyTorch blocks old .pt models starting in 2.6, e.g. YOLO in the Impact Pack)
- xFormers can't load C++/CUDA extensions (version conflict)