-
Notifications
You must be signed in to change notification settings - Fork 3k
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
[Web] WebGPU incorrect output for Segment Anything Model (SAM) #18311
Comments
We have this https://github.com/microsoft/onnxruntime-inference-examples/tree/main/js/segment-anything example and I did not run into it but I used a newer dev build and used samexporter. |
ah, the model inputs/outputs are quite a bit different than the models I use.
waiting for CI to finish. |
### Description For Resize, when `noScale` is true, the shader can become very simple, which is not related with `attributes.mode` anymore. So we should remove those parts of shader code for simplification. This PR can also fix #18311 since the `noScale` are all true in that model. However, #18311 also exposes that the Resize implementation for `linear` mode has bug. It seems that the currently implementation always treat the input as either 2d or 4d tensor, however, the actual input is 3d tensor, that's why the shader compilation is failed. We may need to fix it in a separate PR.
I've just tried 1.16.3, but the error still seems to be persist. Was the latest release meant to include this fix? cc @guschmue |
…t#18321) ### Description For Resize, when `noScale` is true, the shader can become very simple, which is not related with `attributes.mode` anymore. So we should remove those parts of shader code for simplification. This PR can also fix microsoft#18311 since the `noScale` are all true in that model. However, microsoft#18311 also exposes that the Resize implementation for `linear` mode has bug. It seems that the currently implementation always treat the input as either 2d or 4d tensor, however, the actual input is 3d tensor, that's why the shader compilation is failed. We may need to fix it in a separate PR.
…t#18321) ### Description For Resize, when `noScale` is true, the shader can become very simple, which is not related with `attributes.mode` anymore. So we should remove those parts of shader code for simplification. This PR can also fix microsoft#18311 since the `noScale` are all true in that model. However, microsoft#18311 also exposes that the Resize implementation for `linear` mode has bug. It seems that the currently implementation always treat the input as either 2d or 4d tensor, however, the actual input is 3d tensor, that's why the shader compilation is failed. We may need to fix it in a separate PR.
Describe the issue
Attempting to run the original Segment Anything Models (SAM) results in warnings and incorrect output. cc @guschmue @fs-eire
Output
Incorrect (WebGPU) output:
Correct (WASM) output:
Warnings
To reproduce
Run the following code in a browser that supports WebGPU:
Urgency
high - Blocks WebGPU support in Transformers.js
ONNX Runtime Installation
Released Package
ONNX Runtime Version or Commit ID
1.16.1
Execution Provider
'webgpu' (WebGPU)
The text was updated successfully, but these errors were encountered: