bes-dev / stable_diffusion.openvino

Apache License 2.0
1.53k stars 207 forks source link

RuntimeError: [ PARAMETER_MISMATCH ] Failed to set input blob with precision: I64, if CNNNetwork input blob precision is: FP64 #110

Closed alabasterfox closed 1 year ago

alabasterfox commented 1 year ago

Hi

I get the error:

RuntimeError: [ PARAMETER_MISMATCH ] Failed to set input blob with precision: I64, if CNNNetwork input blob precision is: FP64

whenever i run with --init-image?

terminal> python3 demo.py --prompt "test image" --init-image ./output.png --mask ./output-mask.png --strength 0.5

The image I'm passing is the one created from the last run (I'm trying to do some inpainting). I believe it's saying that the image is Formatted as int-64 when its looking for float-64. Since it was generated from the engine, that leads me to believe it does some type of float => int conversion when writing the final image? Is that right? Do we need to up-convert images int => float before passing it to the engine?

asdrubalivan commented 1 year ago

I'm getting the same error after using jpg images, and also using the data/input.png image

alabasterfox commented 1 year ago

thank goodness its not just me

asdrubalivan commented 1 year ago

Yes, I've been trying to debug the issue but I haven't worked yet with Torch to see. I will try later an older version to see if it works.

El jue, 29 dic 2022 a la(s) 12:20, Albert @.***) escribió:

thank goodness its not just me

— Reply to this email directly, view it on GitHub https://github.com/bes-dev/stable_diffusion.openvino/issues/110#issuecomment-1367442753, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAIQW5VFXXMFZ23UVTEKLWTWPW23VANCNFSM6AAAAAATH3SIRI . You are receiving this because you commented.Message ID: @.***>

-- Asdrúbal Iván Suárez Rivera

alabasterfox commented 1 year ago

Same, would you like to work together on the issue?

thathappiness commented 1 year ago

the same problem, have you guys fixed it?

asdrubalivan commented 1 year ago

Not yet, I'm not sure how to solve but I can help working on that @alabasterfox @thathappiness

alabasterfox commented 1 year ago

@asdrubalivan @thathappiness same, what's the best way to compare notes?

arisha07 commented 1 year ago

I have started to get similar issue - RuntimeError: [ PARAMETER_MISMATCH ] Failed to set input blob with precision: I32, if CNNNetwork input blob precision is: FP64

After forcing variable "t" to be float the above error seems to resolve. In line https://github.com/bes-dev/stable_diffusion.openvino/blob/master/stable_diffusion_engine.py#L186 change "t" : t to "t": float(t)

alabasterfox commented 1 year ago

After some testing with both demo.py and demo_web.py, I am confirming that making arisha07's change in stable_diffusion_engine.py

from:

            # predict the noise residual
            noise_pred = result(self.unet.infer_new_request({
                "latent_model_input": latent_model_input,
                "t": t,
                "encoder_hidden_states": text_embeddings
            }))

to:

            # predict the noise residual
            noise_pred = result(self.unet.infer_new_request({
                "latent_model_input": latent_model_input,
                "t": float(t),  // <== updated
                "encoder_hidden_states": text_embeddings
            }))

has resolved the issue in my SD engine as well

asdrubalivan commented 1 year ago

Maybe this can be committed to the official package?