Skip to content

Commit afa8a24

Browse files
authored
refactor: Replace manual patches merging with merge_nested_dicts (#10360)
1 parent 493b81e commit afa8a24

File tree

1 file changed

+4
-11
lines changed

1 file changed

+4
-11
lines changed

comfy/samplers.py

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -306,17 +306,10 @@ def _calc_cond_batch(model: BaseModel, conds: list[list[dict]], x_in: torch.Tens
306306
copy_dict1=False)
307307

308308
if patches is not None:
309-
# TODO: replace with merge_nested_dicts function
310-
if "patches" in transformer_options:
311-
cur_patches = transformer_options["patches"].copy()
312-
for p in patches:
313-
if p in cur_patches:
314-
cur_patches[p] = cur_patches[p] + patches[p]
315-
else:
316-
cur_patches[p] = patches[p]
317-
transformer_options["patches"] = cur_patches
318-
else:
319-
transformer_options["patches"] = patches
309+
transformer_options["patches"] = comfy.patcher_extension.merge_nested_dicts(
310+
transformer_options.get("patches", {}),
311+
patches
312+
)
320313

321314
transformer_options["cond_or_uncond"] = cond_or_uncond[:]
322315
transformer_options["uuids"] = uuids[:]

0 commit comments

Comments
 (0)