microsoft / webnn-developer-preview

MIT License
37 stars 7 forks source link

[Stable Diffusion1_5][WebNN GPU] Failed to execute 'add' on 'MLGraphBuilder': The input operand data types don't match. #16

Closed JiangYueBook closed 1 month ago

JiangYueBook commented 1 month ago

Repro Steps:

  1. Launch latest Chrome Canary on Windows 11
    C:\Users\AppData\Local\Google\Chrome SxS\Application\chrome.exe" --enable-features=WebMachineLearningNeuralNetwork

  2. Visit https://microsoft.github.io/webnn-developer-preview/demos/stable-diffusion-1.5/

  3. Click Load Models button.

Actual Result:

   TypeError: Failed to execute 'add' on 'MLGraphBuilder': The input operand data types don't match. (The error occur when text encode begin to create session.)

Environment:

Chrome Canary: 128.0.6600.0 (Official Build)

GPU Driver Version: 32.0.101.5762

Device OS CPU GPU
Laptop Windows 11 23H2 Ultra 7 155H Intel Arc Graphics
ibelem commented 1 month ago

Caused by argMax change: chromium-review.googlesource.com/c/chromium/src/+/5692538

huningxin commented 1 month ago

Caused by argMax change: chromium-review.googlesource.com/c/chromium/src/+/5692538

Yes, this is caused by argMax default output data type is "int32" in Chromium prototype now. WebNN EP should set the newly introduced MLArgMinMaxOptions.outputDataType to "int64" for ONNX ArgMax whose output is "int64". This is the same root cause for https://github.com/microsoft/webnn-developer-preview/issues/17.

@Honry has a fix for WebNN EP: https://github.com/microsoft/onnxruntime/pull/21385

@philloooo, would you plan to send a spec change?

/cc @fdwr

fdwr commented 1 month ago

@philloooo, would you plan to send a spec change?

~~WebNN spec update for argMin/argMax is here for single axis: https://github.com/webmachinelearning/webnn/pull/724/files Maybe we should add the outputDataType in that same one? I'm fine with it being separate too.~~

(update 1) Never mind, as the above was just merged, and so we need a new separate spec CR for adding outputDataType.

(update 2) Spec change here: https://github.com/webmachinelearning/webnn/pull/730

(update 3) ORT WebNN EP updated: "Add outputDataType option for the ArgMax/ArgMin ops" https://github.com/microsoft/onnxruntime/pull/21385