diff options
author | AUTOMATIC1111 <16777216c@gmail.com> | 2023-08-09 14:40:06 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-08-09 14:40:06 +0300 |
commit | c8c48640e661a0275c9ffa04b148e20213f3e902 (patch) | |
tree | 601a7db6f6811ce6c0a1cb02e7d9c30b705595bb /modules/devices.py | |
parent | 2617598b7a014676611134566fafd6604e6c4486 (diff) | |
parent | 386245a26427a64f364f66f6fecd03b3bccfd7f3 (diff) |
Merge pull request #12426 from AUTOMATIC1111/split_shared
Split shared.py into multiple files
Diffstat (limited to 'modules/devices.py')
-rw-r--r-- | modules/devices.py | 10 |
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 |