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

tfjs-lite not runing #8512

Open
AbdullahElsheshtawy opened this issue Feb 9, 2025 · 1 comment
Open

tfjs-lite not runing #8512

AbdullahElsheshtawy opened this issue Feb 9, 2025 · 1 comment
Assignees
Labels
comp:tfjs-tflite type:bug Something isn't working

Comments

@AbdullahElsheshtawy
Copy link

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/[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}`);
}
@AbdullahElsheshtawy AbdullahElsheshtawy added the type:bug Something isn't working label Feb 9, 2025
@AbdullahElsheshtawy
Copy link
Author

AbdullahElsheshtawy commented Feb 9, 2025

Just tested it works on linux but not on windows

Edit: No it does not work on linux or windows

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

No branches or pull requests

2 participants
@AbdullahElsheshtawy and others