Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MultiControlNet in Tensor type #152

Open
coldsakrua opened this issue Oct 19, 2024 · 0 comments
Open

MultiControlNet in Tensor type #152

coldsakrua opened this issue Oct 19, 2024 · 0 comments

Comments

@coldsakrua
Copy link

coldsakrua commented Oct 19, 2024

Hi,i'm trying to finetune a multiControlNet using inpaint and canny. i find that, when the images' type is PIL.Image, the model could generate successfully, however , when i try to transform the image to torch.Tensor(the shape is B C H W), the output would be wrong.

Here is my code

controlnet1 = ControlNetModel.from_pretrained("inpaint") ##inpaint model
controlnet2 = ControlNetModel.from_pretrained("canny") ##canny model 
pipe = StableDiffusionControlNetPipeline.from_pretrained(
    "botp/stable-diffusion-v1-5",
    controlnet=[controlnet1,controlnet2],
    local_files_only=True,safety_checker=None
)

def trans(img):
    return torch.tensor(img)


outputs = pipe(prompt=prompt,
               image=[trans(rec1),trans(canny)],
               control_image=trans(control_img),
               controlnet_conditioning_scale=[1.0, 0.8],
               mask_image=trans(mask_img),
               eta=1,
               num_inference_step=20,generator=generator,negative_prompt=negative_prompt).images

the generated image is
output

i dont know the reason. Does anyone else have the same situation?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant