microsoft / onnxruntime

ONNX Runtime: cross-platform, high performance ML inferencing and training accelerator
https://onnxruntime.ai
MIT License
14.14k stars 2.85k forks source link

[Web] Conv_token_460" failed. Error: Unsupported activation Tanh #21467

Closed elephantpanda closed 1 month ago

elephantpanda commented 1 month ago

Describe the issue

Getting the error: Conv_token_460" failed. Error: Unsupported activation Tanh from this model:

To reproduce

Trying to run inference using the library:

https://cdn.jsdelivr.net/npm/onnxruntime-web/dist/ort.webgpu.min.js

(I have got it to work find with other models and this also works with the wasm provider).

Urgency

No response

ONNX Runtime Installation

Released Package

ONNX Runtime Version or Commit ID

webgpu

Execution Provider

'webgpu' (WebGPU)

skottmckay commented 1 month ago

What version of ORT are you using? Tanh is listed as a supported operator for the WebGPU EP.

https://github.com/microsoft/onnxruntime/blob/main/js/web/docs/webgpu-operators.md and it was added in August last year.

https://github.com/microsoft/onnxruntime/pull/17124

Possible that it's related to an attempted fusion and this helper needs updating: https://github.com/microsoft/onnxruntime/blob/ae3ec2e9ac1f1a1dde23407051d409fc8b52e639/js/web/lib/wasm/jsep/webgpu/ops/fuse-utils.ts#L18

@fs-eire or @guschmue would know better.

elephantpanda commented 1 month ago

The model says it's irVersion=8. (I did not make the model). Yes, it sounds like it's a problem with a fusion of Conv+Tanh. I notice Tanh is not in that link you gave for the fused operators.

I tested it again and it works fine with wasm but not with webgpu. But I want to use webgpu because it's much faster. Here is the full error: Error: [WebGPU] Kernel "[Conv] Conv_token_460" failed. Error: Unsupported activation Tanh at Object._OrtRun (ort-wasm-simd.jsep.js:9:401) at async Dd (wasm-core-impl.ts:562:19) at async fi.run (session-handler-inference.ts:109:21) at async e.run (inference-session-impl.ts:110:21) at async runInference (onnxloader.html:361:28)

guschmue commented 1 month ago

this should be fixed in ort-1.19.