diff options
author | AUTOMATIC <16777216c@gmail.com> | 2022-09-08 10:31:20 +0300 |
---|---|---|
committer | AUTOMATIC <16777216c@gmail.com> | 2022-09-08 10:31:20 +0300 |
commit | 61785cef656335cce3ab50b420301d2821f7c5e1 (patch) | |
tree | df66e649b5e30c21fb68d6b93af9bb48b0f48584 /modules/shared.py | |
parent | 0fedd50886fb2f745cc6faab001090b77fbd0382 (diff) | |
parent | 9ddaf8269ebfb11c8fd2e48f0e8d33c125213437 (diff) |
Merge remote-tracking branch 'origin/master'
Diffstat (limited to 'modules/shared.py')
-rw-r--r-- | modules/shared.py | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/modules/shared.py b/modules/shared.py index beb6f9bb..e529ec27 100644 --- a/modules/shared.py +++ b/modules/shared.py @@ -36,9 +36,12 @@ parser.add_argument("--opt-split-attention", action='store_true', help="enable o parser.add_argument("--listen", action='store_true', help="launch gradio with 0.0.0.0 as server name, allowing to respond to network requests")
cmd_opts = parser.parse_args()
-cpu = torch.device("cpu")
-gpu = torch.device("cuda")
-device = gpu if torch.cuda.is_available() else cpu
+if torch.has_cuda:
+ device = torch.device("cuda")
+elif torch.has_mps:
+ device = torch.device("mps")
+else:
+ device = torch.device("cpu")
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
|