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

Error while using controlnet #174

Open
Fqlox opened this issue Oct 1, 2024 · 0 comments
Open

Error while using controlnet #174

Fqlox opened this issue Oct 1, 2024 · 0 comments

Comments

@Fqlox
Copy link

Fqlox commented Oct 1, 2024

I used the branch "feature/controlnet-adaption" that allows the use of controlnet in stream diffusion.

I followed the basecode in example/txt2img/multi.py and I got an error, I did try different controlnet but got the same error :
RuntimeError: Tensors must have same number of dimensions: got 5 and 4

Here is the code so far :


from PIL import Image

o_image = Image.open("input.png").convert("RGB").resize((512, 512))

from streamdiffusion import StreamDiffusion
from streamdiffusion.image_utils import postprocess_image
from otherBranch.StreamDiffusion.utils.wrapper import StreamDiffusionWrapper

model_id_or_path = "digiplay/AnalogMadness-realistic-model-v7"

stream = StreamDiffusionWrapper(
    model_id_or_path,
    t_index_list=[0, 8, 16, 24, 32, 40, 45, 49],
    lora_dict=None,
    seed=42,
    mode="txt2img",
    cfg_type="none",
    controlnet_dicts=[{"lllyasviel/control_v11p_sd15_canny": 1.0}],
    HyperSD_lora_id="./Hyper-SD15-1step-lora.safetensors", # Local HyperSD
    width=512,
    height=512,
    frame_buffer_size=1,
    acceleration="xformers",

)

prompt = "Clown in space, black and white"
# Prepare the stream
stream.prepare(prompt)

# Warmup >= len(t_index_list) x frame_buffer_size
for _ in range(4):
    stream(controlnet_images=[o_image])

# Run the stream infinitely
while True:
    x_output = stream(controlnet_images=[o_image])
    postprocess_image(x_output, output_type="pil")[0].show()
    input_response = input("Press Enter to continue or type 'stop' to exit: ")
    if input_response == "stop":
        break
        

Is there something I did not get ?

Thanks in advance

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