Skip to content

[ModelPatcher] object patch not properly removed between runs #6303

@huchenlei

Description

@huchenlei

Expected Behavior

Object patch is properly removed from different workflow execution.

Actual Behavior

Object patches are not removed when executing different patches.

Steps to Reproduce

  1. Install ComfyUI-layerdiffuse and patch PR: Fix SD15 memory sharing huchenlei/ComfyUI-layerdiffuse#119

  2. Start ComfyUI server

  3. Execute workflow1 and observe that it executes normally layer_diffusion_fg_example (1).json
    image

  4. Execute workflow 2 and observe error
    layer_diffusion_cond_joint_bg (1).json
    image

  5. Restart ComfyUI server

  6. Execute workflow 2 and observe that it executes normally
    image

  7. Execute wrkflow 1 and observe the same error as in step 4 on workflow 2
    image

Putting a breakpoint here https://github.com/huchenlei/ComfyUI-layerdiffuse/blob/ab409eefbba15ecc322a6ea830e077576e904326/lib_layerdiffusion/attention_sharing.py#L334

on step 7 run indicates that the objectes_backup is not restored after the previous run.
image

Debug Logs

N/A

Other

Ref issue: huchenlei/ComfyUI-layerdiffuse#115

Workflow 2 input image:
309219693-e7e2d80e-ffbe-4724-812a-5139a88027e3

Metadata

Metadata

Labels

BugSomething is confirmed to not be working properly.Important

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions