microsoft / microsoft/onnxruntime
[WebGPU] BEN2-ONNX `Failed to create a WebGPU compute pipeline: [Invalid ShaderModule "LayerNorm"] is invalid due to a previous error.`
- Dominant language
- C++
- Stars
- 21.9k
- Forks
- 4.2k
- Avg merge
- 4d 11h
- Merged PRs (30d)
- 184
Description
### Describe the issue
Running https://huggingface.co/onnx-community/BEN2-ONNX/resolve/main/onnx/model_fp16.onnx in-browser on WebGPU produces this error:
```
An error occurred during model execution: "Error: failed to call OrtRun(). ERROR_CODE: 1, ERROR_MESSAGE: /mnt/azure_nvme_temp/_work/1/s/onnxruntime/core/providers/webgpu/buffer_manager.cc:562 WGPUBuffer onnxruntime::webgpu::BufferManager::Create(size_t, wgpu::BufferUsage, bool, bool) const [ONNXRuntimeError] : 1 : FAIL : Failed to create a WebGPU compute pipeline: [Invalid ShaderModule "LayerNorm"] is invalid due to a previous error.
- While validating compute stage ([Invalid ShaderModule "LayerNorm"], entryPoint: "main").
```
### To reproduce
```js
import { pipeline } from 'https://cdn.jsdelivr.net/npm/@huggingface/transformers@4.3.0';
const segmenter = await pipeline('background-removal', 'onnx-community/BEN2-ONNX', {
device: 'webgpu'
});
const url = 'https://fastly.picsum.photos/id/669/600/400.jpg?hmac=bLAdpG18lXVIyqPBMPwwlhVGhHlsl-KMMmOPa3NYxw0';
const output = await segmenter([url]);
output[0].save('mask.png');
```
### Urgency
high: blocks BEN2-ONNX usage in Transformers.js 4.3.0 (previously working in 4.2.0)
### ONNX Runtime Installation
Released Package
### ONNX Runtime Version or Commit ID
latest
### Execution Provider
'webgpu' (WebGPU)
Contributor guide
Research direction
Start by running the supplied Transformers.js 4.3.0 WebGPU reproduction with BEN2-ONNX, then compare it with 4.2.0 as reported. Trace the WebGPU execution provider's LayerNorm shader and compute-pipeline validation around the reported error. Done means BEN2-ONNX background removal runs successfully in-browser on WebGPU without the invalid ShaderModule failure.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp, javascript
- Domain
- machine-learning, performance
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100