webtoon / dreamstyler

Official implementation of "DreamStyler: Paint by Style Inversion with Text-to-Image Diffusion Models" (AAAI24)
Apache License 2.0
36 stars 3 forks source link

Question about style mixing #6

Open whit3mperial opened 1 month ago

whit3mperial commented 1 month ago

Hi, thanks to your great work. But I wonder how can perform style mixing using this code. I didn't see any part of code related to this, should I modify the code myself to achieve this?

nmhkahn commented 3 weeks ago

Hi, sorry for the late reply. As you mentioned, the open-source code does not include style mixing. You can implement style mixing by providing different prompt tokens for each layer For example,

prompt = "A painting of a bridge in the style of {}"
prompt_style = [prompt.format(f"<17>-T{i}, <10>-T{i}, <22>-T{i}") for i in range(6)]
...
output = pipeline(
    prompt=prompt_style,
    num_inference_steps=25,
    cross_attention_kwargs=cross_attention_kwargs,
    generator=torch.Generator(device=accelerator.device).manual_seed(seed)
).images[0]