question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Wrong path for tflite.wasm

See original GitHub issue

I’m trying to add the virtual background to an angular 11 project and getting an error when trying to load the tflite model:

GET http://localhost:4200/tflite.wasm 404 (Not Found)
tflite.js:9 wasm streaming compile failed: TypeError: Failed to execute 'compile' on 'WebAssembly': HTTP status code is not ok
tflite.js:9 falling back to ArrayBuffer instantiation
GET http://localhost:4200/tflite.wasm 404 (Not Found)
failed to asynchronously prepare wasm: RuntimeError: abort(both async and sync fetching of the wasm failed). Build with -s ASSERTIONS=1 for more info.

This is how I import tflite.js:

import createTFLiteModule from './tflite/tflite';
import createTFLiteSIMDModule from './tflite/tflite-simd';

The path to tflite.wasm is hardcoded in tflite/tflite.js. Is there a config option to set the path without modifying tflite.js?

var wasmBinaryFile="tflite.wasm"

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:12 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
benbrocommented, May 31, 2021

I still prefer the automatic import.model.url solution but we can also pass custom locateFile function:

const createdTFLiteSIMD = await createTFLiteModule({locateFile: () => 'path/to//tflite.wasm'});
0reactions
benbrocommented, Jun 12, 2021

Not sure about complication flags but we can use locateFile to dynamically specify the model location. This is from the Selfie Segmentation example:

const selfieSegmentation = new SelfieSegmentation({locateFile: (file) => {
  return `https://cdn.jsdelivr.net/npm/@mediapipe/selfie_segmentation/${file}`;
}});
Read more comments on GitHub >

github_iconTop Results From Across the Web

tfjs-tflite gives the error RuntimeError: Aborted(). Build with - ...
I'm trying to use the tfjs-tflite package to run a segmentation model but when I load the model, I get the following warning...
Read more >
Build TFLite, Opencv for Wasm | With SIMD and CMake
Paths are expressed as relative to the root position of the TensorFlow repository. Keep the directory structure and copy the lists below. All...
Read more >
TFLite model error, Regular TensorFlow ops are not ...
I have installed tflite_runtime 2.5.0.post1 using !pip install --extra-index-url https://google-coral.github.io/py-repo/ tflite_runtime ...
Read more >
Topics tagged tflite
Topics tagged tflite. ... 1, 879, February 25, 2022. Applying Grad-Cam to a model that was converted to Tensorflow Lite ... Help with...
Read more >
Build Android app for custom object detection (TensorFlow ...
Deploy the TFlite model on Android / iOS / IoT devices using the sample TFLite ... #!python generate_tfrecord.py output.csv output_pb.txt /path/to/images ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found