Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

502
Vistas
when loading a model in tensorflow.js for node, the weights aren't loaded/saved

When I load a trained model (In tensorflow.js within Node.js) that I have previously saved, the model topology is being loaded, but none of the weights are loaded (so I have to train the model from scratch). No errors are thrown.

To save the model, I am using:

async function save(path) {
    //misc. unrelated code goes here
    await model.save('file://' + path);
}

All files appear (model.json and weights.bin), and no errors are thrown.

To load the file, I am using :

async function load(path) {
    //misc. unrelated code goes here.
    model = await tf.loadLayersModel('file://' + path + '/model.json');
}

Again, no errors are thrown. The model topology is loaded correctly. The weights aren't though, and the model behaves as if I had just constructed/compiled it.

I am using tfjs-node save:

const tf = require('@tensorflow/tfjs');
require("tfjs-node-save");

I would really appreciate any help or advice!!! Thank you!

about 4 years ago · Juan Pablo Isaza
2 Respuestas
Responde la pregunta

0

save() and loadLayersModel() are async functions.

model.save(url).then(result => console.log(result));

tf.loadLayersModel(url).then(result => console.log(result))

about 4 years ago · Juan Pablo Isaza Denunciar

0

So it turns out this was just a dumb mistake.

I had a wrapper function to add some functionality to model.compile().

For some godforsaken reason, in that function, I called my initialization function, which overwrote the model.

tl;dr, don't overwrite a model you want to keep.

about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda