I was a bit misguided here, while indeed pytorch doesnt support cuda 12 yet
its binaries come with its own cuda so in short you can get pytorch but internally it uses an older cuda version which is no problem despite WSL2 ubuntu on a newer system will report cuda12.
Part of my misguidance was all the nvidea documentation that made me think i needed to install more on the WSL client, its the host Win 11 that needs the toolkit, however the WSL2 client only needs pytorch (no gpu drivers somehow WSL can share the graphics adapter among its host.
(not sure if docker will work the same, probaply yes i think).
So to install pytorch
install MD nanno #those 2 are not required but handy
WSL --update
WSL --install -d Ubuntu
sudo apt update
sudo apt install python3-pip
pip3 install torch torchvision torchaudio --extra-index-url https://download.pytorch.org/whl/cu117
jupyter-lab --allow-root
Then open your web browser to url displayed in the console
Inside a jupyter notebook :
import torch
torch.cuda.current_device()
torch.cuda.get_device_name(torch.cuda.current_device()) #output will be : `NVIDIA GeForce RTX 3080 Ti' or some other card
#in another cell type
!nvidea-smi
Side tip in a browser howto use gpu with pytorch
Notice 1 Also if you're new to WSL, notice that the next time you want to start Ubuntu you might be tempted to type WSL in a windows cmd box, though that's not the way to go, WSL is for setting up a Linux version, what you need to click to get Ubuntu, is a new orange ubuntu icon in your start menu.
Notice 2 This install is quite simple no security configuration jupyterlab is running as root user, at home thats good enough not recomended at work though this is just a plain simple install.
Notice 3 WSL is able to install other Linux versions too, i just use Ubuntu i think in the area of neural networks it's the basic OS.
And as for this install you only get a console (no GUI), but thats enough to run jupyter lab, for a config file or so inside this console i recomend nano its a simple text editor, and mc is a norton alike file comander (from the old days), i think thats enough to get you started for the linux side