MCPcopy Index your code
hub / github.com/cubiq/ComfyUI_IPAdapter_plus / set_model_patch_replace

Function set_model_patch_replace

IPAdapterPlus.py:210–226  ·  view source on GitHub ↗
(model, patch_kwargs, key)

Source from the content-addressed store, hash-verified

208 self.to_kvs[key.replace(".weight", "").replace(".", "_")].weight.data = value
209
210def set_model_patch_replace(model, patch_kwargs, key):
211 to = model.model_options["transformer_options"].copy()
212 if "patches_replace" not in to:
213 to["patches_replace"] = {}
214 else:
215 to["patches_replace"] = to["patches_replace"].copy()
216
217 if "attn2" not in to["patches_replace"]:
218 to["patches_replace"]["attn2"] = {}
219 else:
220 to["patches_replace"]["attn2"] = to["patches_replace"]["attn2"].copy()
221
222 if key not in to["patches_replace"]["attn2"]:
223 to["patches_replace"]["attn2"][key] = Attn2Replace(ipadapter_attention, **patch_kwargs)
224 model.model_options["transformer_options"] = to
225 else:
226 to["patches_replace"]["attn2"][key].add(ipadapter_attention, **patch_kwargs)
227
228def ipadapter_execute(model,
229 ipadapter,

Callers 1

ipadapter_executeFunction · 0.85

Calls 2

Attn2ReplaceClass · 0.85
addMethod · 0.80

Tested by

no test coverage detected