-
-
Notifications
You must be signed in to change notification settings - Fork 293
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
Issue running test with Tensorflow.js #1876
Comments
can you try applying the rollup commonjs plugin in your test runner config per https://modern-web.dev/guides/going-buildless/es-modules/#transform-commonjs-to-esm |
Thank you for the advice! I'll try when I'm back in front of my computer. |
Apologies for the delay @bennypowers. Applying the rollup commons plugin didn't seem to help. I created a minimal repo that reproduces the issue here: https://github.com/thekevinscott/wtr-tfjs-test It's got two tests, https://github.com/thekevinscott/wtr-tfjs-test/runs/5174139315?check_suite_focus=true Here's the output of that test run:
Here is my
|
I can't dig into it further right now but hopefully that clue is helpful. Have you considered bundling tf.js using esbuild prior to running the dev server, and redirecting imports to the bundled files? |
I tried a few strategies with regards to esbuild. 1 - esbuild as a plugin. Didn't work. 2 - esbuild as a pre-bundling step. Also didn't work (though a different error this time). 3 - TFJS also publishes a pre-bundled file, |
Hi there, I'm using @web/dev-server on a TFJS based pose estimation component I'm dabbling with. It's nowhere near done, but I did have some pain getting it working using ESM. Right now, I can do pose/face/hand estimation which relies on the GPU TFJS implementation. My strategy was pre-bundling, but I've used this strategy in the past on other similarly stubborn libraries and when I need the implementation to match I end up hand creating an adapter to make sure the ESM modules from my bundle match what you'd expect from the CJS based solution. I didn't do that here because I didn't care. Anyway, maybe my repo would help? I have the Rollup bundling configs in my rollup.configs folder. Hope it helps! If not good luck! |
Really appreciate that @bengfarrell ! I'll take a look and follow up with questions / what I find. |
Hello there,
I'm trying to write a unit test on some code that leverages Tensorflow.js.
Here's a sample test:
This fails with the error:
I've tried (via playwright) Firefox and Webkit, and get the same error.
Tensorflow.js specifies backends that can be CPU or WebGL. My best guess is this is where the problem lies.
If I open a Debug window in Chrome, I can inspect
long.js
. I'm not entirely sure where it's loaded from, but I assume TFJS; here's the beginning of that module:I tried setting the backend to leverage the CPU instead, but that doesn't seem to have an effect.
Do you have any feedback in how to interpret the error
ReferenceError: module is not defined
? I'm not exactly sure what this means.Thanks!
The text was updated successfully, but these errors were encountered: