Open
Description
System information
- Windows 11
- tfjs-lite (npm)
Describe the current behavior
node_modules\@tensorflow\tfjs-tflite\dist\tf-tflite.node.js:9723
var a = self.location, b = a.origin;
^
ReferenceError: self is not defined
at module$exports$google3$third_party$tensorflow_lite_support$web$task$codegen$common$emscripten_module_loader.EmscriptenModuleLoader.getLocation (C:\dev\Arduino-Ai-Image-Classification\node_modules\@tensorflow\tfjs-tflite\dist\tf-tflite.node.js:9723:13)
at $jscomp.generator.Engine_.program_ (C:\dev\Arduino-Ai-Image-Classification\node_modules\@tensorflow\tfjs-tflite\dist\tf-tflite.node.js:9682:333)
at $jscomp.generator.Engine_.nextStep_ (C:\dev\Arduino-Ai-Image-Classification\node_modules\@tensorflow\tfjs-tflite\dist\tf-tflite.node.js:321:22)
at $jscomp.generator.Engine_.next_ (C:\dev\Arduino-Ai-Image-Classification\node_modules\@tensorflow\tfjs-tflite\dist\tf-tflite.node.js:304:130)
at $jscomp.generator.Generator_.next (C:\dev\Arduino-Ai-Image-Classification\node_modules\@tensorflow\tfjs-tflite\dist\tf-tflite.node.js:334:83)
at b (C:\dev\Arduino-Ai-Image-Classification\node_modules\@tensorflow\tfjs-tflite\dist\tf-tflite.node.js:336:80)
Describe the expected behavior
the model loads
Standalone code to reproduce the issue
package.json
"dependencies": {
"@tensorflow/tfjs-backend-cpu": "^4.22.0",
"@tensorflow/tfjs-core": "^4.22.0",
"@tensorflow/tfjs-tflite": "0.0.1-alpha.10"
}
index.js
import '@tensorflow/tfjs-backend-cpu';
import * as tf from '@tensorflow/tfjs-core';
import * as tflite from '@tensorflow/tfjs-tflite';
const loadModel = async (modelPath) => {
await tflite.setWasmPath('https://cdn.jsdelivr.net/npm/@tensorflow/%3Ca%20href="http://github.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="0b7f6d6178267f6d67627f6e4b3b253b253a266a677b636a253a3b">[email protected]/dist/');
const response = await fetch(modelPath);
const modelBuffer = response.arrayBuffer();
return await tflite.loadTFLiteModel(modelBuffer);
}
function main() {
const model = loadModel('./model/model.tflite');
console.log(`Model: {model}`);
}