aboutsummaryrefslogtreecommitdiffstats
path: root/modules/lowvram.py
diff options
context:
space:
mode:
authorAbdullah Barhoum <ka70911@gmail.com>2022-09-11 05:11:27 +0000
committerAUTOMATIC1111 <16777216c@gmail.com>2022-09-11 06:49:43 +0000
commitb5d1af11b7dc718d4d91d379c75e46f4bd2e2fe6 (patch)
treeac8bf9b5aebe5d95da9c91fe45b7cc19e5d845ea /modules/lowvram.py
parent065e310a3f4efdcdc206cfb70656108c70bc1c6d (diff)
downloadstable-diffusion-webui-gfx803-b5d1af11b7dc718d4d91d379c75e46f4bd2e2fe6.tar.gz
stable-diffusion-webui-gfx803-b5d1af11b7dc718d4d91d379c75e46f4bd2e2fe6.tar.bz2
stable-diffusion-webui-gfx803-b5d1af11b7dc718d4d91d379c75e46f4bd2e2fe6.zip
Modular device management
Diffstat (limited to 'modules/lowvram.py')
-rw-r--r--modules/lowvram.py8
1 files changed, 2 insertions, 6 deletions
diff --git a/modules/lowvram.py b/modules/lowvram.py
index bd117491..079386c3 100644
--- a/modules/lowvram.py
+++ b/modules/lowvram.py
@@ -1,13 +1,9 @@
import torch
+from modules.devices import get_optimal_device
module_in_gpu = None
cpu = torch.device("cpu")
-if torch.has_cuda:
- device = gpu = torch.device("cuda")
-elif torch.has_mps:
- device = gpu = torch.device("mps")
-else:
- device = gpu = torch.device("cpu")
+device = gpu = get_optimal_device()
def setup_for_low_vram(sd_model, use_medvram):
parents = {}