aboutsummaryrefslogtreecommitdiff
path: root/modules/devices.py
diff options
context:
space:
mode:
authorAUTOMATIC1111 <16777216c@gmail.com>2023-08-09 10:25:35 +0300
committerAUTOMATIC1111 <16777216c@gmail.com>2023-08-09 10:25:35 +0300
commit386245a26427a64f364f66f6fecd03b3bccfd7f3 (patch)
tree427cd01b680c318acb964076232b064882d2f364 /modules/devices.py
parent7d81ecbea6b558addd356d49c56891d04bc91fd4 (diff)
split shared.py into multiple files; should resolve all circular reference import errors related to shared.py
Diffstat (limited to 'modules/devices.py')
-rw-r--r--modules/devices.py10
1 files changed, 1 insertions, 9 deletions
diff --git a/modules/devices.py b/modules/devices.py
index ce59dc53..c01f0602 100644
--- a/modules/devices.py
+++ b/modules/devices.py
@@ -3,7 +3,7 @@ import contextlib
from functools import lru_cache
import torch
-from modules import errors
+from modules import errors, shared
if sys.platform == "darwin":
from modules import mac_specific
@@ -17,8 +17,6 @@ def has_mps() -> bool:
def get_cuda_device_string():
- from modules import shared
-
if shared.cmd_opts.device_id is not None:
return f"cuda:{shared.cmd_opts.device_id}"
@@ -40,8 +38,6 @@ def get_optimal_device():
def get_device_for(task):
- from modules import shared
-
if task in shared.cmd_opts.use_cpu:
return cpu
@@ -97,8 +93,6 @@ nv_rng = None
def autocast(disable=False):
- from modules import shared
-
if disable:
return contextlib.nullcontext()
@@ -117,8 +111,6 @@ class NansException(Exception):
def test_for_nans(x, where):
- from modules import shared
-
if shared.cmd_opts.disable_nan_check:
return