Skip to content

How to combine Inpaint and ContentRef templates? #1541

Description

@Amark-cheey

Hi, thanks for this great project.

I am trying to use these two templates together:

  • DiffSynth-Studio/Template-KleinBase4B-Inpaint
  • DiffSynth-Studio/Template-KleinBase4B-ContentRef

My goal is:

  • Use Inpaint to modify only the masked area.
  • Use ContentRef to guide the generated content/style.

Both templates work individually, but I am not sure how to combine them correctly.

I tried loading both templates:

template = TemplatePipeline.from_pretrained(
    torch_dtype=torch.bfloat16,
    device="cuda",
    model_configs=[
        ModelConfig(model_id="DiffSynth-Studio/Template-KleinBase4B-Inpaint"),
        ModelConfig(model_id="DiffSynth-Studio/Template-KleinBase4B-ContentRef"),
    ],
)

and passing both inputs:

template_inputs=[
    {
        "model_id": 0,
        "image": image,
        "mask": mask,
        "force_inpaint": True,
    },
    {
        "model_id": 1,
        "image": reference_image,
    },
]

But I got:

paste error or describe the unexpected result here
  1. Is combining Inpaint + ContentRef supported?
  2. Is this the correct way to pass multiple templates?
  3. Are there any additional settings required for ContentRef + Inpaint?

Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions