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

Getting error message in console: Initialization of backend webgpu failed #231

Closed
1 task done
jht9629-nyu opened this issue Nov 19, 2024 · 9 comments · Fixed by #232
Closed
1 task done

Getting error message in console: Initialization of backend webgpu failed #231

jht9629-nyu opened this issue Nov 19, 2024 · 9 comments · Fixed by #232
Labels
bug Something isn't working

Comments

@jht9629-nyu
Copy link

Issue Type

Runtime Error, Unexpected Behavior

ml5.js Version

v.1.2.0 Latest

Development Environment

p5js editror

Browser & Operating System

Chrome Macos Version 131.0.6778.69 (Official Build) (arm64)

Issue Description

From documentation:
https://docs.ml5js.org/#/reference/bodypose

run the example sketch:
https://editor.p5js.org/ml5/sketches/hMN9GdrO3
Following error is displayed in console:
Initialization of backend webgpu failed
index.js:259 TypeError: t.requestAdapterInfo is not a function
at Object.factory (pose-detection.esm.js:17:97544)
at async b.ready (engine.js:93:13)
at async fG.loadModel (index.js:256:7)

Minimal Reproducible Example

No response

Code of Conduct

  • I agree to follow this project's Code of Conduct
@jht9629-nyu jht9629-nyu added the bug Something isn't working label Nov 19, 2024
@jht9629-nyu
Copy link
Author

Today the error is no longer been displayed, but this may be indicative of a bigger issue where sub components of ml5 library are changing that are not part of the npm library delivery

@TimChen3345
Copy link

TimChen3345 commented Nov 21, 2024

I am running into the same issue:
https://editor.p5js.org/tc3902/sketches/7h4WyQQe7

Here is the error I got in console:

Initialization of backend webgpu failed
TypeError: t.requestAdapterInfo is not a function
at Object.factory (https://unpkg.com/ml5@1/dist/ml5.min.js:18352:117148)
at async b.ready (https://unpkg.com/ml5@1/dist/ml5.min.js:102:916)
at async fG.loadModel (https://unpkg.com/ml5@1/dist/ml5.min.js:18359:1917)

I am running in Google Chrome Version 131.0.6778.86 (Official Build) (64-bit)

Processor: AMD Ryzen 9 7845HX with Radeon Graphics 3.00 GHz
Edition Windows 11 Home
Version 23H2
Installed on ‎8/‎16/‎2024
OS build 22631.4460
Experience Windows Feature Experience Pack 1000.22700.1047.0

@shiffman
Copy link
Member

I've been noticing this issue recently as well, it seems to come and go, it's very strange! I wonder if it's something related to chrome/webgpu update? It resolves if you force a non-webgpu backend, for example:

ml5.setBackend('webgl');

@TimChen3345
Copy link

It works! Thanks!

@jht9629-nyu
Copy link
Author

Error "Initialization of backend webgpu failed"
is back!
Run this sketch:
https://editor.p5js.org/ml5/sketches/hMN9GdrO3
On Chrome Version 131.0.6778.86 (Official Build) (arm64
macOS 14.7.1

@shiffman
Copy link
Member

Strange! For me, I get the "error" but the sketch still runs. @jht9629-nyu if you add ml5.setBackend('webgl') before you load the model does that resolve it for you? (It does for me.)

function preload() {
  // Load the bodyPose model
  ml5.setBackend("webgl");
  bodyPose = ml5.bodyPose();
}

@ziyuan-linn do you have any ideas about this? It seems something has changed with webgpu?

@jht9629-nyu
Copy link
Author

jht9629-nyu commented Nov 26, 2024

Error message does not appear to affect behavior,
my sketches still work with it.
Using ml5.setBackend("webgl") as @shiffman recommends makes the error message go away.

@ziyuan-linn
Copy link
Member

@shiffman When webgpu backend fails, tfjs automatically rolls back to webgl. I tried logging the backend after the warning:
backend is logged as webgl after the warning

The tfjs webgpu backend called the requestAdapterInfo function. This function is deprecated and non-standard, so Chrome might have removed it during a recent update.

It looks like this issue has already been addressed by tfjs in tensorflow/tfjs#8392, which is released in tfjs-v4.22.0. I think bumping our dependency versions should fix the issue.

This might also be a good opportunity to look into bringing back Dependabot, which automatically checks for dependency updates.

@shiffman
Copy link
Member

Thank you @ziyuan-linn! I re-enabled dependabot in the repo as well as updated tensorflow.js version in #232. I haven't had a chance to test it yet though. Take a look and we can do a quick release for just this update if need be!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants