flagged the loader as not implemented, for now
This commit is contained in:
@@ -1,7 +1,6 @@
|
||||
from .common import *
|
||||
from .torchvulkan_loader import *
|
||||
|
||||
|
||||
# Map all your custom nodes classes with the names that will be displayed in the UI.
|
||||
NODE_CLASS_MAPPINGS = {
|
||||
"Torchvulkan Loader": TorchVulkanLoader
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
import comfy
|
||||
import torchvulkan
|
||||
import torch
|
||||
|
||||
global cpu_state
|
||||
cpu_state = None
|
||||
|
||||
@@ -25,6 +25,7 @@ class TorchVulkanLoader:
|
||||
CATEGORY = "Backends"
|
||||
|
||||
def load_to_torchvulkan(self, device, model = None, clip = None, vae = None):
|
||||
raise NotImplementedError
|
||||
device = torch.device(f"vulkan:{device}")
|
||||
if model: model.to(device)
|
||||
if clip: clip.to(device)
|
||||
|
||||
@@ -0,0 +1,28 @@
|
||||
import comfy
|
||||
import comfy.model_management
|
||||
|
||||
# Patched version of comfy.model_management.get_torch_device that allows vulkan devices to be treated as default
|
||||
def get_torch_device_patched():
|
||||
global directml_enabled
|
||||
global cpu_state
|
||||
if directml_enabled:
|
||||
global directml_device
|
||||
return directml_device
|
||||
if cpu_state == CPUState.MPS:
|
||||
return torch.device("mps")
|
||||
if cpu_state == CPUState.CPU:
|
||||
return torch.device("cpu")
|
||||
else:
|
||||
if True:
|
||||
# for now, just see if this works c:
|
||||
return torch.device(f"vulkan:0")
|
||||
else:
|
||||
if is_intel_xpu():
|
||||
return torch.device("xpu", torch.xpu.current_device())
|
||||
elif is_ascend_npu():
|
||||
return torch.device("npu", torch.npu.current_device())
|
||||
elif is_mlu():
|
||||
return torch.device("mlu", torch.mlu.current_device())
|
||||
else:
|
||||
return torch.device(torch.cuda.current_device())
|
||||
comfy.model_management.get_torch_device = get_torch_device_patched
|
||||
Reference in New Issue
Block a user