Pytorch support for sm120

For people running Stable Diffusion and encountering the error:

RuntimeError: CUDA error: no kernel image is available for execution on the device
CUDA kernel errors might be asynchronously reported at some other API call, so the stacktrace below might be incorrect.

while having a working PyTorch install, for example (copied from a mesaage above):

import torch
input_ids = torch.randint(0, 1000, (1, 10), device="cuda")
embedding = torch.nn.Embedding(1000, 64).cuda()
output = embedding(input_ids)
print(output)

The issue is mostly that the working PyTorch version is not installed in the Stable Diffusion WebUI virtual environment. You can verify this by running the snippet above using the Python inside the WebUI venv:

C:\Users...\stable-diffusion-webui\venv\Scripts\python.exe

If it fails there, you need to install the correct PyTorch version in that environment.

On Windows, the steps are:

cd C:\Users...\stable-diffusion-webui\venv\Scripts
.\activate (if PowerShell blocks this, run: Set-ExecutionPolicy -Scope Process -ExecutionPolicy Bypass)

Then, inside the venv:

pip uninstall torch torchvision torchaudio -y
pip install --pre torch torchvision torchaudio --index-url https://download.pytorch.org/whl/nightly/cu129

It worked for me, hope it helps others.