Using second gpu?
I have 2 gpus. Identical 3070 ti. I want my Gradio Stable Diffusion HLKY webui to run on gpu 1, not 0.Couldn’t find the answer anywhere, and fiddling with every file just didn’t work.
2022-09-21T20:15:39Z
Hi@Telecino! Setting the pipeline’s device tocuda:1should move it to your second GPU:from diffusers import StableDiffusionPipeline

pipe = StableDiffusionPipeline.from_pretrained("CompVis/stable-diffusion-v1-4", use_auth_token=True)
pipe = pipe.to("cuda:1")
2022-09-21T20:20:24Z
I think, latest version supports running with --gpu 1 parameter.github.comsd-webui/stable-diffusion-webui/blob/master/docs/2.cli.md# Setting command line options

Edit `scripts/relauncher.py` `python scripts/webui.py` becomes `python scripts/webui.py --no-half --precision=full`

# List of command line options

```
optional arguments:
  -h, --help            show this help message and exit
  --ckpt CKPT           path to checkpoint of model (default: models/ldm/stable-diffusion-v1/model.ckpt)
  --cli CLI             don't launch web server, take Python function kwargs from this file. (default: None)
  --config CONFIG       path to config which constructs model (default: configs/stable-diffusion/v1-inference.yaml)
  --defaults DEFAULTS   path to configuration file providing UI defaults, uses same format as cli parameter (default:
                        configs/webui/webui.yaml)
  --esrgan-cpu          run ESRGAN on cpu (default: False)
  --esrgan-gpu ESRGAN_GPU
                        run ESRGAN on specific gpu (overrides --gpu) (default: 0)
  --extra-models-cpu    run extra models (GFGPAN/ESRGAN) on cpu (default: False)
  --extra-models-gpu    run extra models (GFGPAN/ESRGAN) on gpu (default: False)
  --gfpgan-cpu          run GFPGAN on cpu (default: False)This file has been truncated.show original
2022-09-21T22:22:37Z
Hey Antonplease, tell me… where exactly (or suggestion) would I add these 3 lines of code?anton-l:from diffusers import StableDiffusionPipeline

pipe = StableDiffusionPipeline.from_pretrained("CompVis/stable-diffusion-v1-4", use_auth_token=True)
pipe = pipe.to("cuda:1")
2022-09-21T22:30:14Z
Hey Nidkal!Since i also installed the facefixer and upscaller, in ‘scripts/relauncher.py’ I addedadditional_arguments = “–gpu 1 --esrgan-gpu 1 --gfpgan-gpu 1”When I Generate, i get the errorExpected all tensors to be on the same device, but found at least two devices, cuda:1 and cuda:0! (when checking argument for argument index in method wrapper__index_select)I get the same error when I edit these 3 values in webui.py setting them as default=1I get the same error when I only put --gpu 1I did all permutations of the above.Any idea?
2022-09-22T11:23:40Z
Hi@Telecino! I believe you are using thesd-webuiproject, did you try to check theirdiscussions pageor their discord server? These forums are for thediffuserslibrary
2022-09-28T02:18:53Z
Both TensorFlow and PyTorch has a method to limit which GPUs are visible.For example,os.environ["CUDA_VISIBLE_DEVICES"]="1"