Skip to content

[Web] bug(webgpu): Error: FILTER_IN_CHANNEL should be equal to DATA_CHANNEL #27277

@kaeru-shigure

Description

@kaeru-shigure

Describe the issue

When attempting to run inference with WebGPU on a specific model, I encounter the error shown in the title.
Since this issue does not occur with the WASM Execution Provider, I believe it is likely specific to WebGPU.
For details, please refer to the reproduction steps.

To reproduce

Save the following code as HTML and open it in browser.

<!doctype html>
<html lang="en">
  <head> </head>
  <body>
    <code id="log" style="white-space: pre-wrap"></code>
    <script src="https://cdn.jsdelivr.net/npm/onnxruntime-web@1.24.1/dist/ort.all.min.js"></script>
    <script>
      let logText = "";
      async function runTest(providerName = "webgpu") {
        log.innerText = logText += `[${providerName}] initializing...\n`;
        try {
          ort.env.wasm.wasmPaths =
            "https://cdn.jsdelivr.net/npm/onnxruntime-web@1.24.1/dist/";
          ort.env.wasm.numThreads = 1;
          ort.env.wasm.simd = true;

          const onnxUrl =
            "https://huggingface.co/kaeru-shigure/sandbox-onnx/resolve/main/mobilenet_vocals.onnx";
          const session = await ort.InferenceSession.create(onnxUrl, {
            executionProviders: [providerName],
            externalData: [
              {
                path: "mobilenet_vocals.onnx.data",
                data: onnxUrl + ".data",
              },
            ],
          });

          const result = await session.run({
            [session.inputMetadata[0].name]: new ort.Tensor(
              "float32",
              new Float32Array(1 * 2 * 1323000),
              [1, 2, 1323000],
            ),
          });
          const outputName = Object.keys(result)[0];
          const outputTensor = result[outputName];

          log.textContent =
            logText += `[${providerName}] inference ok: output tensor shape=${outputTensor.dims}\n`;
        } catch (error) {
          window.lastError = error;
          console.error(error);
          log.textContent =
            logText += `[${providerName}] inference failed: ${error.stack ?? error.message}\n`;
        }
      }
      (async () => {
        await runTest("webgpu");
        await runTest("wasm");
      })();
    </script>
  </body>
</html>

Result

[webgpu] initializing...
[webgpu] inference failed: Error: [WebGPU] Kernel "[Conv] node_Conv_3503_token_566" failed. Error: FILTER_IN_CHANNEL should be equal to DATA_CHANNEL
    at Object._OrtRun (https://cdn.jsdelivr.net/npm/onnxruntime-web@1.24.1/dist/ort-wasm-simd-threaded.jsep.mjs:2:446)
    at async Ti (https://cdn.jsdelivr.net/npm/onnxruntime-web@1.24.1/dist/ort.all.min.js:4585:26841)
    at async aa.run (https://cdn.jsdelivr.net/npm/onnxruntime-web@1.24.1/dist/ort.all.min.js:4585:34287)
    at async r.run (https://cdn.jsdelivr.net/npm/onnxruntime-web@1.24.1/dist/ort.all.min.js:6:18533)
    at async runTest (converter_debug.html:29:26)
    at async converter_debug.html:49:9
[wasm] initializing...
[wasm] inference ok: output tensor shape=1,2,1323000

Urgency

No response

ONNX Runtime Installation

Released Package

ONNX Runtime Version or Commit ID

1.24.1

Execution Provider

'webgpu' (WebGPU)

Metadata

Metadata

Assignees

No one assigned

    Labels

    .NETPull requests that update .net codeep:WebGPUort-web webgpu providerplatform:webissues related to ONNX Runtime web; typically submitted using template

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions