aboutsummaryrefslogtreecommitdiffstats
path: root/modules/devices.py
diff options
context:
space:
mode:
authorAUTOMATIC <16777216c@gmail.com>2022-10-22 11:04:14 +0000
committerAUTOMATIC <16777216c@gmail.com>2022-10-22 11:04:14 +0000
commit50b5504401e50b6c94eba41b37fe212b2f27b792 (patch)
tree179b0d18306dd84cb2b32351efb89b183e26592c /modules/devices.py
parente80bdcab91df0d91fa268991bee1d0143e81920a (diff)
downloadstable-diffusion-webui-gfx803-50b5504401e50b6c94eba41b37fe212b2f27b792.tar.gz
stable-diffusion-webui-gfx803-50b5504401e50b6c94eba41b37fe212b2f27b792.tar.bz2
stable-diffusion-webui-gfx803-50b5504401e50b6c94eba41b37fe212b2f27b792.zip
remove parsing command line from devices.py
Diffstat (limited to 'modules/devices.py')
-rw-r--r--modules/devices.py14
1 files changed, 5 insertions, 9 deletions
diff --git a/modules/devices.py b/modules/devices.py
index 8a159282..dc1f3cdd 100644
--- a/modules/devices.py
+++ b/modules/devices.py
@@ -15,14 +15,10 @@ def extract_device_id(args, name):
def get_optimal_device():
if torch.cuda.is_available():
- # CUDA device selection support:
- if "shared" not in sys.modules:
- commandline_args = os.environ.get('COMMANDLINE_ARGS', "") #re-parse the commandline arguments because using the shared.py module creates an import loop.
- sys.argv += shlex.split(commandline_args)
- device_id = extract_device_id(sys.argv, '--device-id')
- else:
- device_id = shared.cmd_opts.device_id
-
+ from modules import shared
+
+ device_id = shared.cmd_opts.device_id
+
if device_id is not None:
cuda_device = f"cuda:{device_id}"
return torch.device(cuda_device)
@@ -49,7 +45,7 @@ def enable_tf32():
errors.run(enable_tf32, "Enabling TF32")
-device = device_interrogate = device_gfpgan = device_bsrgan = device_esrgan = device_scunet = device_codeformer = get_optimal_device()
+device = device_interrogate = device_gfpgan = device_bsrgan = device_esrgan = device_scunet = device_codeformer = None
dtype = torch.float16
dtype_vae = torch.float16