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] The ONNX model cannot be loaded via WASM in the IOS17 browser. #22086

Closed
zyhhahah opened this issue Sep 13, 2024 · 8 comments
Closed

[Web] The ONNX model cannot be loaded via WASM in the IOS17 browser. #22086

zyhhahah opened this issue Sep 13, 2024 · 8 comments
Labels
platform:mobile issues related to ONNX Runtime mobile; typically submitted using template platform:web issues related to ONNX Runtime web; typically submitted using template

Comments

@zyhhahah
Copy link

Describe the issue

This is the encountered error, which only occurs in the web environment on the iPhone.
Snipaste_2024-09-13_11-14-25
I initially thought this issue was caused by version differences, so I tried many versions. They all worked fine in the web environment on Android and Windows. Based on the error message, it seems to be caused by insufficient memory. I tried many different models, including some very small ones, but the issue persisted. However, I found that when using the WebGL backend, the issue does not occur. It only happens with the WASM backend.

To reproduce

In my project, the code is quite complex, so I simplified it following the official example to reproduce the issue. The model used can be any ONNX model. The devices I tested on include iPhone 13 Pro, iPhone 13 Pro Max, and iPhone 15 Pro Max, and the issue occurred on all of them.
image

Urgency

My project is currently at a standstill due to this issue, and I'm not sure whether it's a problem with my implementation or a version-related issue. I'm wondering if I'm the only one encountering this problem.

ONNX Runtime Installation

Built from Source

ONNX Runtime Version or Commit ID

多版本都存在这个问题

Execution Provider

'webgl' (WebGL), 'wasm'/'cpu' (WebAssembly CPU)

@zyhhahah zyhhahah added the platform:web issues related to ONNX Runtime web; typically submitted using template label Sep 13, 2024
@github-actions github-actions bot added the platform:mobile issues related to ONNX Runtime mobile; typically submitted using template label Sep 13, 2024
@zyhhahah zyhhahah changed the title [Web] The ONNX model cannot be loaded via WASM in the iPhone browser. [Web] The ONNX model cannot be loaded via WASM in the IOS17 browser. Sep 13, 2024
@transcranial
Copy link

transcranial commented Sep 15, 2024

We are also seeing this exact error with onnxruntime-web 1.19.0, running a tiny model in all browsers on iOS 17.6.1 as well as iPadOS 17.6.1. Works fine in all browsers including safari on macOS. Downgrading onnxruntime-web to 1.18.0 fixes this for us.

@satyajandhyala
Copy link
Contributor

The Out of Memory error was previously reported and fixed by rolling back Emscripten SDK upgrade, backe to 3.1.59. Did reproduce this error with the latest code on main branch?

@zyhhahah
Copy link
Author

我们在 onnxruntime-web 1.19.0 中也看到了同样的错误,在 iOS 17.6.1 和 iPadOS 17.6.1 上的所有浏览器中运行了一个小模型。在包括 macOS 上的 Safari 在内的所有浏览器中都可以正常工作。将 onnxruntime-web 降级到 1.18.0 可以为我们解决这个问题。

Thank you for your help. The issue indeed doesn't exist in version 1.18.0, it seems I carelessly missed this during my earlier attempts. I really appreciate your reminder.

@zyhhahah
Copy link
Author

之前曾报告过内存不足错误,并通过将 Emscripten SDK 升级回滚到 3.1.59 来修复。是否使用主分支上的最新代码重现了此错误?

Hello, I tried using the latest code as per your suggestion. Unfortunately, the same error still occurs.

@fs-eire
Copy link
Contributor

fs-eire commented Sep 24, 2024

@zyhhahah could you help to test whether the following versions work or not:

  • 1.20.0-dev.20240919-bd60add8ce
  • 1.19.2
  • 1.18.0

@zyhhahah
Copy link
Author

@fs-eire I tested these three versions on various platforms.

  • 1.20.0-dev.20240919-bd60add8ce ==> on iOS system no available backend found. ERR: [wasm] RangeError: Out of memory

  • 1.19.2 ==> on iOS system no available backend found. ERR: [wasm] RangeError: Out of memory

  • 1.18.0 ==> success

  • 1.18.0 ==> But there's one thing I'm not sure is a potential issue: when I enable crossOriginIsolated mode, my iPhone still encounters an out-of-memory problem, and it only runs normally when I manually set wasm.numThreads to 1. wasm.numThreads cannot be set to the default value or a number greater than 1.

@fs-eire
Copy link
Contributor

fs-eire commented Sep 24, 2024

I think this is a known issue of Safari and it is fixed in iOS v18.0: emscripten-core/emscripten#19374

Screenshot from BrowserStack - https://jsfiddle.net/tpz1k9d7/3/

iOS 17:
image

iOS 18:
image

@zyhhahah
Copy link
Author

@fs-eire Thank you for your reminder. I have also tested it and confirmed that indeed in iOS 18 this issue does not occur, so my question can be closed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
platform:mobile issues related to ONNX Runtime mobile; typically submitted using template platform:web issues related to ONNX Runtime web; typically submitted using template
Projects
None yet
Development

No branches or pull requests

4 participants