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

NlpManager load model error #1277

Closed
ghost opened this issue Feb 10, 2023 · 1 comment
Closed

NlpManager load model error #1277

ghost opened this issue Feb 10, 2023 · 1 comment

Comments

@ghost
Copy link

ghost commented Feb 10, 2023

Good morning, once the model has been trained and saved to disk, then when trying to load it, it returns an error
Cannot convert undefined or null to object
TypeError: Cannot convert undefined or null to object\n at Function.keys ()\n at NeuralNlu.fromJSON

I am training the network with:
var FileName = "./ScriptsNodejs/ModelsTrained/ModelTrained.json";
const manager = new NlpManager({ languages: ['es'], forceNER: true, modelFileName: FileName, autoSave: false });
manager.train();
manager.save();

and then to load it (in other process):
var FileName = "./ScriptsNodejs/ModelsTrained/ModelTrained.json";
const manager = new NlpManager({ languages: ['es'] });
manager.load(FileName);

I have also tried with the import method and it returns the same error:
var FileName = "./ScriptsNodejs/ModelsTrained/ModelTrained.json";
const data = fs.readFileSync(FileName, 'utf8');
const manager = new NlpManager({ languages: ['es'] });
manager.import(data);

Can anyone know what causes this error?

Thank you very much

@ghost
Copy link
Author

ghost commented Feb 10, 2023

Sorry, I solved the error,
It was a problem when saving the model, although it looked well structured if I opened it in a text editor, it was not created well, I close the thread.
Thank you.

@ghost ghost closed this as completed Feb 10, 2023
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

0 participants