Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

503
Visualizações
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 Respostas
Responde à pergunta

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 Relatório

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda