Skip to content
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] 1.20.0 breaks SkipSimplifiedLayerNormalization backwards compatibility. Missing Input: model.layers.0.input_layernorm.weight #22704

Closed
xenova opened this issue Nov 3, 2024 · 16 comments
Assignees
Labels
platform:web issues related to ONNX Runtime web; typically submitted using template release:1.20.0

Comments

@xenova
Copy link

xenova commented Nov 3, 2024

Describe the issue

After upgrading to onnxruntime-node 1.20.0, I obtain the following error when trying to run models which were previously exported (and working) with earlier versions of onnx/onnxruntime:

Non-zero status code returned while running SkipSimplifiedLayerNormalization node. Name:'/model/layers.0/post_attention_layernorm/SkipLayerNorm' Status Message: /onnxruntime_src/include/onnxruntime/core/framework/op_kernel_context.h:42 const T* onnxruntime::OpKernelContext::Input(int) const [with T = onnxruntime::Tensor] Missing Input: model.layers.0.input_layernorm.weight

To reproduce

Attempt to run one of the following models:

Urgency

Blocks upgrading transformers.js to use onnxruntime-node v1.20.0

ONNX Runtime Installation

Released Package

ONNX Runtime Version or Commit ID

1.20.0

Execution Provider

'wasm'/'cpu' (WebAssembly CPU)

@xenova xenova added the platform:web issues related to ONNX Runtime web; typically submitted using template label Nov 3, 2024
@xenova
Copy link
Author

xenova commented Nov 3, 2024

It also breaks for WASM EP (WebGPU still works): https://jsfiddle.net/9v4fa3gw/

@fs-eire
Copy link
Contributor

fs-eire commented Nov 4, 2024

@xenova Thank you for the issue report! I did some investigation and identified the issue is in the CPU implementation of f16 [Skip][Simplified]LayerNormalizaion.

This issue is not web specific. All language binding may run into this issue if using CPU/f16 on any of the 4 operators.

We will do the fix ASAP and will publish a dev build of onnxruntime-web once it's done. Will also work on a patch release to include the fix.

@xenova
Copy link
Author

xenova commented Nov 4, 2024

@fs-eire Amazing - thanks so much! 🥳 I'll upgrade the build when you're ready 👍 Will this include a dev version of onnxruntime-node too?

@oyazdanb
Copy link

oyazdanb commented Nov 4, 2024

@xenova Thank you for the issue report! I did some investigation and identified the issue is in the CPU implementation of f16 [Skip][Simplified]LayerNormalizaion.

This issue is not web specific. All language binding may run into this issue if using CPU/f16 on any of the 4 operators.

We will do the fix ASAP and will publish a dev build of onnxruntime-web once it's done. Will also work on a patch release to include the fix.

I see this issue in Onnxruntime-DirectML as well; Does this fix help with ort-dml?

@fs-eire
Copy link
Contributor

fs-eire commented Nov 4, 2024

Will investigate this issue. It looks like the problem is in CPU EP and

@fs-eire Amazing - thanks so much! 🥳 I'll upgrade the build when you're ready 👍 Will this include a dev version of onnxruntime-node too?

Currently the pipeline does not support this but I can do a manual publish if necessary.

@fs-eire
Copy link
Contributor

fs-eire commented Nov 4, 2024

@xenova Thank you for the issue report! I did some investigation and identified the issue is in the CPU implementation of f16 [Skip][Simplified]LayerNormalizaion.
This issue is not web specific. All language binding may run into this issue if using CPU/f16 on any of the 4 operators.
We will do the fix ASAP and will publish a dev build of onnxruntime-web once it's done. Will also work on a patch release to include the fix.

I see this issue in Onnxruntime-DirectML as well; Does this fix help with ort-dml?

I am not sure if the problem that you saw is exactly caused by this. If it is, the fix should help.

@xenova
Copy link
Author

xenova commented Nov 5, 2024

Currently the pipeline does not support this but I can do a manual publish if necessary.

Yes please! 😇 Transformers.js v3.1.0 will include this fix

@fs-eire
Copy link
Contributor

fs-eire commented Nov 6, 2024

The fix is being worked on, and we want to make sure the change fixes the problem before it's merged.

@xenova could you please help to verify if the fix works? (replace the dist folder -> dist.zip)

@xenova
Copy link
Author

xenova commented Nov 6, 2024

Here is the new error message I get now:

failed to inference ONNX model: Error: failed to call OrtRun(). ERROR_CODE: 2, ERROR_MESSAGE: Non-zero status code returned while running SkipSimplifiedLayerNormalization node. Name:'/model/layers.0/post_attention_layernorm/SkipLayerNorm' Status Message: gamma is expected to have 1 dimension, got 0.

@fs-eire
Copy link
Contributor

fs-eire commented Nov 8, 2024

Did some update and this is the latest fix -> dist.zip

@xenova
Copy link
Author

xenova commented Nov 10, 2024

Great! That fixed it @fs-eire 🥳 Please let me know when you put a dev build out 👍

@xenova
Copy link
Author

xenova commented Nov 14, 2024

@fs-eire I see it was merged in f0ac5e0. could you put out a dev build for onnxruntime-node? 😇

@jywu-msft
Copy link
Member

@fs-eire I see it was merged in f0ac5e0. could you put out a dev build for onnxruntime-node? 😇

+@guschmue

@ulgens
Copy link

ulgens commented Nov 26, 2024

👀

@fs-eire
Copy link
Contributor

fs-eire commented Dec 2, 2024

onnxruntime-node 1.20.1 is released and should have included the fixes.

@xenova
Copy link
Author

xenova commented Dec 2, 2024

I can confirm that fixes it. Thanks!

@xenova xenova closed this as completed Dec 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
platform:web issues related to ONNX Runtime web; typically submitted using template release:1.20.0
Projects
None yet
Development

No branches or pull requests

7 participants