diff --git a/nodes.py b/nodes.py index 77fec6a..239ef98 100644 --- a/nodes.py +++ b/nodes.py @@ -85,16 +85,18 @@ def slice_cnet(h, h_len, w, w_len, model:comfy.controlnet.ControlBase, img): if img is None: img = model.cond_hint_original hint = tiling.get_slice(img, h*8, h_len*8, w*8, w_len*8) + device = comfy.model_management.get_torch_device() if isinstance(model, comfy.controlnet.ControlLora): - model.cond_hint = hint.float().to(model.device) + model.cond_hint = hint.float().to(device) else: - model.cond_hint = hint.to(model.control_model.dtype).to(model.device) + model.cond_hint = hint.to(model.control_model.dtype).to(device) def slices_T2I(h, h_len, w, w_len, model:comfy.controlnet.ControlBase, img): model.control_input = None if img is None: img = model.cond_hint_original - model.cond_hint = tiling.get_slice(img, h*8, h_len*8, w*8, w_len*8).float().to(model.device) + device = comfy.model_management.get_torch_device() + model.cond_hint = tiling.get_slice(img, h*8, h_len*8, w*8, w_len*8).float().to(device) # TODO: refactor some of the mess @@ -366,4 +368,4 @@ def sample(self, model, add_noise, noise_seed, tile_width, tile_height, tiling_s NODE_DISPLAY_NAME_MAPPINGS = { "BNK_TiledKSamplerAdvanced": "TiledK Sampler (Advanced)", "BNK_TiledKSampler": "Tiled KSampler", -} \ No newline at end of file +}