Comfy-Org/ComfyUI · error · RuntimeError
Cannot create multigpu deepclone of {self.model.__class__.__
Error message
Cannot create multigpu deepclone of {self.model.__class__.__name__}: the loader that produced this model does not support multigpu (cached_patcher_init is not initialized). Use a core loader (CheckpointLoaderSimple, UNETLoader, CLIPLoader/DualCLIPLoader, VAELoader), or have the custom loader register a cached_patcher_init factory. What it means
deepclone_multigpu() must rebuild an untainted copy of the model on another GPU via the loader factory in cached_patcher_init; it refuses to deepcopy an already-patched model. When the loader that produced the patcher never registered that factory (custom loader path), there is no safe way to create the multigpu clone, so it raises with guidance to use a core loader.
Source
Thrown at comfy/model_patcher.py:509
n.cached_hook_patches[group][k] = self.cached_hook_patches[group][k]
n.hook_backup = self.hook_backup
n.current_hooks = self.current_hooks.clone() if self.current_hooks else self.current_hooks
n.forced_hooks = self.forced_hooks.clone() if self.forced_hooks else self.forced_hooks
n.is_clip = self.is_clip
n.hook_mode = self.hook_mode
n.cached_patcher_init = self.cached_patcher_init
n.is_multigpu_base_clone = self.is_multigpu_base_clone
n.clone_base_uuid = self.clone_base_uuid
for callback in self.get_all_callbacks(CallbacksMP.ON_CLONE):
callback(self, n)
return n
def deepclone_multigpu(self, new_load_device=None, models_cache: dict[uuid.UUID,ModelPatcher]=None):
logging.info(f"Creating deepclone of {self.model.__class__.__name__} for {new_load_device if new_load_device else self.load_device}.")
if self.cached_patcher_init is None:
raise RuntimeError(
f"Cannot create multigpu deepclone of {self.model.__class__.__name__}: "
"the loader that produced this model does not support multigpu "
"(cached_patcher_init is not initialized). Use a core loader "
"(CheckpointLoaderSimple, UNETLoader, CLIPLoader/DualCLIPLoader, VAELoader), "
"or have the custom loader register a cached_patcher_init factory."
)
comfy.model_management.unload_model_and_clones(self)
# Produce a freshly-loaded patcher from the loader factory so the multigpu
# clone owns its own untainted model weights (rather than relying on
# copy.deepcopy of an already-patched/already-loaded module).
temp_model_patcher: ModelPatcher | list[ModelPatcher] = self.cached_patcher_init[0](*self.cached_patcher_init[1])
if len(self.cached_patcher_init) > 2:
temp_model_patcher = temp_model_patcher[self.cached_patcher_init[2]]
# Override clone()'s normal "share self.model + share backup containers" with
# the pristine model from temp_model_patcher plus empty backup containers --
# the fresh model has no patches applied, so any deepcopy of self's stale
# backup/object_patches_backup/pinned would just propagate dead state that
# no longer corresponds to anything in n.model.View on GitHub (pinned to 1c6d8d45b3)
Solutions
- Load the model via a core loader (CheckpointLoaderSimple, UNETLoader, CLIPLoader/DualCLIPLoader, VAELoader).
- Custom loader authors: register cached_patcher_init so your loader is multigpu-capable.
- Alternatively disable multigpu for that model / run it single-GPU.
Defensive patterns
Strategy: validation
Validate before calling
if patcher.cached_patcher_init is None:
raise RuntimeError("model cannot be deepcloned for multigpu; load it with a core loader")
clone = patcher.deepclone_multigpu(new_load_device=cuda1) Type guard
def is_multigpu_capable(patcher) -> bool:
return patcher.cached_patcher_init is not None Prevention
- Use core loaders when running multi-GPU workflows.
- Check cached_patcher_init before requesting multigpu clones.
When it happens
Trigger: deepclone_multigpu(new_load_device=...) on a ModelPatcher with cached_patcher_init == None, e.g. multigpu sampling of a model loaded by a custom node loader.
Common situations: Enabling multi-GPU with custom-node model loaders (IP-Adapter bases, custom UNET loaders, some upscaler pipelines); older loaders predating the cached_patcher_init contract.
Related errors
- Cannot create non-dynamic delegate: cached_patcher_init is n
- Hooks not implemented in ModelPatcherDynamic. Please remove
AI-assisted analysis of Comfy-Org/ComfyUI@1c6d8d45b3 (2026-08-14).
Data as JSON: /api/errors/bc6cf6a2e31d04d8.
Report an issue: GitHub.