aboutsummaryrefslogtreecommitdiffstats
path: root/modules/shared.py
diff options
context:
space:
mode:
authorAUTOMATIC <16777216c@gmail.com>2022-09-11 07:25:02 +0000
committerAUTOMATIC <16777216c@gmail.com>2022-09-11 07:25:02 +0000
commit2e6153e343e5002b5c161d00a43453400be2d884 (patch)
treeefbca339024e4d8aec5abd81c2ed45e6f33b0a17 /modules/shared.py
parenta094b3ab8e4adf300725f8b567c0fd787e9d039a (diff)
parentb5d1af11b7dc718d4d91d379c75e46f4bd2e2fe6 (diff)
downloadstable-diffusion-webui-gfx803-2e6153e343e5002b5c161d00a43453400be2d884.tar.gz
stable-diffusion-webui-gfx803-2e6153e343e5002b5c161d00a43453400be2d884.tar.bz2
stable-diffusion-webui-gfx803-2e6153e343e5002b5c161d00a43453400be2d884.zip
Merge remote-tracking branch 'origin/master'
Diffstat (limited to 'modules/shared.py')
-rw-r--r--modules/shared.py9
1 files changed, 3 insertions, 6 deletions
diff --git a/modules/shared.py b/modules/shared.py
index 6ca9106c..74b0ad89 100644
--- a/modules/shared.py
+++ b/modules/shared.py
@@ -9,6 +9,7 @@ import tqdm
import modules.artists
from modules.paths import script_path, sd_path
+from modules.devices import get_optimal_device
import modules.styles
config_filename = "config.json"
@@ -43,12 +44,8 @@ parser.add_argument("--ui-config-file", type=str, help="filename to use for ui c
cmd_opts = parser.parse_args()
-if torch.has_cuda:
- device = torch.device("cuda")
-elif torch.has_mps:
- device = torch.device("mps")
-else:
- device = torch.device("cpu")
+device = get_optimal_device()
+
batch_cond_uncond = cmd_opts.always_batch_cond_uncond or not (cmd_opts.lowvram or cmd_opts.medvram)
parallel_processing_allowed = not cmd_opts.lowvram and not cmd_opts.medvram