Let me simplify it:
I faced this issue to when I started but now I know how to handle it and this is how you can do it too.
For CPU Only:
If you don't have a GPU and want to use it on CPU, follow these steps:
- Navigate to your folder.
- Find the "webui-user.bat" file.
- Left click on it and choose "Edit."
- Look for the line that says "set commandline_args=" and add "--skip-torch-cuda-test" to it (should look like set commandline_args= --skip-torch-cuda-test).
If you have a gpu and want to use it:
All you need is an NVIDIA graphics card with at least 2 GB of memory. Some people say you need a card with more than 4 GB, but I have a card called MX300, which has 2 GB memory, and I can still use it without any issues for stable diffusion. The only drawback is that it takes 2 to 4 minutes to generate a picture, depending on a few factors. Btw there is a way to run it on AMD gpu too but I don’t know much about it.
Steps to use it on gpu:
- First, download the special version of stable diffusion made for GPU use. You can find it here: https://github.com/automatic1111/stable-diffusion-webui/wiki/install-and-run-on-nvidia-gpus it also tells u how to download and use it but it is outdated information.
- Open the downloaded folder and find the "run.bat" file.
- Double-click on it and it will download torch with cuda enabled if it is just torch than go to step 3 btw I prefer you doing step 3 even if it downloading with cuda. As by default it downloads the old version of torch.
Step 3:
- Before downloading "torch," close the file you are working on.
- Go to this website: https://pytorch.org/get-started/previous-versions/
- Find the right version of "torch" for your device on that website.
- Open the Command Prompt (cmd).
- Copy the path of the "run.bat" file.
- Paste the path into the Command Prompt.
- Add "-m" and the command for "torch" that you got from the website. It should look like this: "pathtothefile -m pip install torch==1.13.0+cu116..."
- Now, run the command.
After the process is complete just run the "run.bat" file again and it will download some necessary library and after that you can use it.
Note:
The reason why people who have gpu but still cant run them on stable diffusion is that they have the wrong version of it and if you have more than one GPU and want to use a specific one of them go to the "webui-user.bat" file and add this line to it "set cuda_visible_devices=1" below the "set commandline_args=". By default stable diffusion will use the best GPU on its own but its a optional step.
And I don't think it will be nessary but if you still face problem using it on gpu you need to download CUDA from NVIDEA website on you computer It's the only remaining solution to try. It is also a good approach to have it installed on you Computer if you are using any A.I related model