diff --git a/comfy/model_management.py b/comfy/model_management.py index 90cf83d84..e278c1210 100644 --- a/comfy/model_management.py +++ b/comfy/model_management.py @@ -87,6 +87,13 @@ def get_torch_device(): else: return torch.device(torch.cuda.current_device()) +def get_containerd_memory_limit(): + cgroup_memory_limit = '/sys/fs/cgroup/memory/memory.limit_in_bytes' + if os.path.isfile(cgroup_memory_limit): + with open(cgroup_memory_limit, 'r') as f: + return int(f.read()) + return 0 + def get_total_memory(dev=None, torch_total_too=False): global directml_enabled if dev is None: @@ -707,12 +714,6 @@ def is_device_mps(device): return True return False -def get_containerd_memory_limit(): - cgroup_memory_limit = '/sys/fs/cgroup/memory/memory.limit_in_bytes' - if os.path.isfile(cgroup_memory_limit): - with open(cgroup_memory_limit, 'r') as f: - return int(f.read()) - return 0 def should_use_fp16(device=None, model_params=0, prioritize_performance=True, manual_cast=False): global directml_enabled