question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Train imported model from JSON fails

See original GitHub issue

Trying to train an imported model from JSON fails.

Use case:

 let net = new LSTM();
      const trainingData = [
        {
          input: 'hi',
          output: 'mom',
        },
        {
          input: 'howdy',
          output: 'dad',
        },
        {
          input: 'hello',
          output: 'sis',
        },
        {
          input: 'yo',
          output: 'bro',
        },
      ];
      net.train(trainingData, { iterations: 20 });

      const net2 = new LSTM().fromJSON(net.toJSON());
      net2.train(trainingData, { iterations: 20 });
      net2.run('hi');

Error:

Error: Network error rate is unexpected NaN, check network configurations and try again.
 Most probably input format is not correct or training data is not enough. 

    at LSTM.train (brain.js\src\recurrent\rnn.ts:628:15)

Fix: Setting dataFormatter.isSetup to true in DataFormatter.fromJSON solve the problem

    dataFormatter.isSetup = true;

So is there any drawback for this Fix ?

Issue Analytics

  • State:open
  • Created 2 years ago
  • Comments:7 (2 by maintainers)

github_iconTop GitHub Comments

3reactions
cpgb85commented, Aug 5, 2022

Thanks for reproducing. I’ll look at this early this week.

Any progress on figuring this out? This is pretty much useless without being able to save a previous network.

2reactions
robertleeplummerjrcommented, Jul 16, 2022

Thanks for reproducing. I’ll look at this early this week.

Read more comments on GitHub >

github_iconTop Results From Across the Web

"WARNING:tensorflow:Model failed to initialize as JSON ...
from keras.layers.merge import add, concatenate from keras.models import Model from keras.engine.topology import Layer import tensorflow as ...
Read more >
Keras won't load json file - deep learning - Stack Overflow
I ran my code and saved saved my model using the following code: model_json = model.to_json() with open(inFilePath+".json", ...
Read more >
Loading model from .params and .json fails - Gluon
json files. I'd like to instantiate the model, but this command: net = gluon.nn.SymbolBlock.imports("model_algo_1-symbol.
Read more >
Struggling to import my object det… | Apple Developer Forums
Whenever I try and import my training data I get the error message: Training Data Error: Empty table from specified data source.
Read more >
What to do when you get an error - Hugging Face Course
If we read the accompanying error message, we can see that there seems to be a problem with the model's config.json file, and...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found