The following error occurred while setting up Stable Diffusion.
Expected all tensors to be on the same device, but found at least two devices, CPU and Cuba:0! (when checking argument for argument index in method wrapper_CUDA__index_select)
There are two devices, CPU and Cuba:0! Which is it? I guess that means.
It seems to occur when you have multiple different GPUs, or when you have a graphics board on board, but the CPU’s internal graphics are enabled.
I didn’t know how to specify this error when it occurred, so I looked around and wrote down how to deal with it.
Assumption
Installed
git clone https://github.com/AUTOMATIC1111/stable-diffusion-webui.git
Introduction Method
We proceeded with the installation based on the following article.
Error occurred
I was able to start the program, but then I typed in a spell and used text2img to generate an image! But at that moment, I got an error.
(´・ω・`)ショボーン
Expected all tensors to be on the same device, but found at least two devices, CPU and Cuba:0! (when checking argument for argument index in method wrapper_CUDA__index_select)
対処方法
Assuming you have installed the software as described in “Assumptions” above,
In the directory “stable-diffusion-webui” under the local repository that you cloned,
Edit “launchi.py” in the “stable-diffusion-webui” directory under the cloned local repository.
Edit this “launch.py” with a text editor.
I used Visual Studio Code.
I think the contents of this section may have changed depending on the version of the software,
Add the following to the line after importing another module, such as an import statement.
CUDA_VISIBLE_DEVICES=0
The reason why 0 is assigned is that the 0th GPU is the one I want to use in my environment.
Please change the value here according to your environment.
Note that this method cannot be used to generate images using the CPU.
コメント