Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

364
Views
TensorFlow.js - error: RangeError: byte length of Float32Array should be a multiple of 4 when pulled the model from Git and running it

Issue:
I created a model in python using tensorflow, and then I converted it to tensorflow.js. I put the model.json and group1-shard1of1.bin in a folder called model inside my node.js server directory. I called upon it and it worked. I later pushed and merged to github.

Later I pulled the main branch and got this error when I ran the code.

error: RangeError: byte length of Float32Array should be a multiple of 4
    at new Float32Array (<anonymous>)
    at Object.decodeWeights (C:\Users\user\Documents\Ml\Trading\server\node_modules\@tensorflow\tfjs-core\dist\tf-core.node.js:5844:30)
    at decodeModelAndOptimizerWeights (C:\Users\user\Documents\Ml\Trading\server\node_modules\@tensorflow\tfjs-layers\dist\tf-layers.node.js:21144:30)
    at C:\Users\aelna\Documents\Ml\Trading\server\node_modules\@tensorflow\tfjs-layers\dist\tf-layers.node.js:21126:26
    at step (C:\Users\user\Documents\Ml\Trading\server\node_modules\@tensorflow\tfjs-layers\dist\tf-layers.node.js:147:27)
    at Object.next (C:\Users\user\Documents\Ml\Trading\server\node_modules\@tensorflow\tfjs-layers\dist\tf-layers.node.js:96:53)
    at fulfilled (C:\Users\user\Documents\Ml\Trading\server\node_modules\@tensorflow\tfjs-layers\dist\tf-layers.node.js:77:28)
info: Server closed

This is how I called the model initally:

    const path = 'file:///Users/user/Documents/Ml\Trading/server/src/services/model/model.json'
    const model1 = await tf.loadLayersModel(path);

I tried :

    const handler = tfn.io.fileSystem('src/services/model/model.json');
    const model1 = await tf.loadLayersModel(handler);

But it did not work.

I believe it has something to do with how I store my model, but I am unsure how to store it.

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!