diff options
author | AUTOMATIC <16777216c@gmail.com> | 2022-09-08 07:31:20 +0000 |
---|---|---|
committer | AUTOMATIC <16777216c@gmail.com> | 2022-09-08 07:31:20 +0000 |
commit | 61785cef656335cce3ab50b420301d2821f7c5e1 (patch) | |
tree | df66e649b5e30c21fb68d6b93af9bb48b0f48584 /modules/lowvram.py | |
parent | 0fedd50886fb2f745cc6faab001090b77fbd0382 (diff) | |
parent | 9ddaf8269ebfb11c8fd2e48f0e8d33c125213437 (diff) | |
download | stable-diffusion-webui-gfx803-61785cef656335cce3ab50b420301d2821f7c5e1.tar.gz stable-diffusion-webui-gfx803-61785cef656335cce3ab50b420301d2821f7c5e1.tar.bz2 stable-diffusion-webui-gfx803-61785cef656335cce3ab50b420301d2821f7c5e1.zip |
Merge remote-tracking branch 'origin/master'
Diffstat (limited to 'modules/lowvram.py')
-rw-r--r-- | modules/lowvram.py | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/modules/lowvram.py b/modules/lowvram.py index 4b78deab..bd117491 100644 --- a/modules/lowvram.py +++ b/modules/lowvram.py @@ -2,9 +2,12 @@ import torch module_in_gpu = None
cpu = torch.device("cpu")
-gpu = torch.device("cuda")
-device = gpu if torch.cuda.is_available() else 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")
def setup_for_low_vram(sd_model, use_medvram):
parents = {}
|