Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

How to combine Inpaint and ContentRef templates?

Open
#1,541 1 comment 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
35/100
Issue type
Documentation
Clarity
Needs clarification
Activity status
Quiet
Tech stack
python

Research direction

Start with the TemplatePipeline.from_pretrained entry point and the ModelConfig and template_inputs usage shown in the issue. Check whether Inpaint and ContentRef are supported together and what the completed input should be; done means a reproducible supported example or a clear limitation and error explanation.

Written by the indexing model from the issue text.

Description

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!

Dominant language
Python
Stars
13.2k
Forks
1.3k
Avg merge
22h 15m
Merged PRs (30d)
31

Getting set up

This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from modelscope/DiffSynth-Studio

All issues in modelscope/DiffSynth-Studio

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.