GithubHelp home page GithubHelp logo

Comments (5)

hlky avatar hlky commented on August 22, 2024

multi-GPU scenario

well do you have multiple gpu? can a specific gpu to the load the model to even be set anywhere?

from sygil-webui.

stevestavropoulos avatar stevestavropoulos commented on August 22, 2024

CUDA_VISIBLE_DEVICES=1 python .../webui.py will run the script on the second GPU and while nvidia-smi will correctly report 6061MiB / 12196MiB usage on that GPU, the memory monitor from the script will report: Peak memory usage: 19 MiB / 12195 MiB / 0.155% which is from the first GPU.

from sygil-webui.

hlky avatar hlky commented on August 22, 2024

i can add --gpu option to set the device index, i think you will still need to do the CUDA_VISIBLE_DEVICES=1 part though

from sygil-webui.

stevestavropoulos avatar stevestavropoulos commented on August 22, 2024

At the start of the script if you also did an os.environ["CUDA_VISIBLE_DEVICES"] = "{gpu}", then the CUDA_VISIBLE_DEVICES won't be needed.

This is tested and working (I just hardcoded the second GPU for the test):

-- stable-diffusion-webui/webui.py     2022-08-25 23:09:29.752912794 +0300
+++ stable-diffusion-webui/webui-gpu1.py        2022-08-26 19:38:20.803732102 +0300
@@ -1,4 +1,5 @@
 import argparse, os, sys, glob
+os.environ["CUDA_VISIBLE_DEVICES"] = "1"
 import gradio as gr
 import k_diffusion as K
 import math
@@ -177,7 +178,7 @@
     def run(self):
         print(f"[{self.name}] Recording max memory usage...\n")
         pynvml.nvmlInit()
-        handle = pynvml.nvmlDeviceGetHandleByIndex(0)
+        handle = pynvml.nvmlDeviceGetHandleByIndex(1)
         self.total = pynvml.nvmlDeviceGetMemoryInfo(handle).total
         while not self.stop_flag:
             m = pynvml.nvmlDeviceGetMemoryInfo(handle)

from sygil-webui.

sazabidesu avatar sazabidesu commented on August 22, 2024

Hi, I'm having a similar issue. My first GPU numbered "0" acording to nvidia-smi doesn't get used when I launch webui.py, only the second one numbered "1" gets used which has half the vram of the first one and gives me green images unless I use --full precision and low resolution.
I'm completely noob in all of this, but how can I force it to use the GPU with the most vram?

Thanks in advance.

from sygil-webui.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.