Open ghnp5 opened 8 months ago
After updating, I'm also trying to load by just calling:
const nsfw = require('nsfwjs');
(...)
_model_layer = await nsfw.load('InceptionV3');
But I'm getting:
nsfwjs | /dock/node_modules/nsfwjs/dist/cjs/index.js:158 nsfwjs | throw new Error("Could not load the model. Make sure you are importing the model.min.js bundle."); nsfwjs | ^ nsfwjs | nsfwjs | Error: Could not load the model. Make sure you are importing the model.min.js bundle. nsfwjs | at /dock/node_modules/nsfwjs/dist/cjs/index.js:158:27 nsfwjs | at step (/dock/node_modules/nsfwjs/dist/cjs/index.js:56:23) nsfwjs | at Object.throw (/dock/node_modules/nsfwjs/dist/cjs/index.js:37:53) nsfwjs | at rejected (/dock/node_modules/nsfwjs/dist/cjs/index.js:29:65) nsfwjs | at process.processTicksAndRejections (node:internal/process/task_queues:95:5) nsfwjs | nsfwjs | Node.js v21.6.2
If I try using what's in the README, using "graph":
_model_layer = await nsfw.load('file://./model/', { type: "graph" });
I get:
nsfwjs | /dock/node_modules/@tensorflow/tfjs-converter/dist/tf-converter.node.js:32096 nsfwjs | this.version = "".concat(graph.versions.producer, ".").concat(graph.versions.minConsumer); nsfwjs | ^ nsfwjs | nsfwjs | TypeError: Cannot read properties of undefined (reading 'producer') nsfwjs | at GraphModel.loadWithWeightMap (/dock/node_modules/@tensorflow/tfjs-converter/dist/tf-converter.node.js:32096:49) nsfwjs | at GraphModel.loadSync (/dock/node_modules/@tensorflow/tfjs-converter/dist/tf-converter.node.js:32063:21) nsfwjs | at /dock/node_modules/@tensorflow/tfjs-converter/dist/tf-converter.node.js:32048:34
So, the only thing that works for me is if I use what I had originally:
_model_layer = await nsfw.load('file://./model/', { size: 299 });
I believe the README is still incorrect, even after the last update you made earlier after my comments in the PR.
Thanks.
@ghnp5 same here ...
Hello
If I'm using this model - https://github.com/infinitered/nsfwjs/tree/master/models/inception_v3
Is it incorrect that I'm loading it this way?
nsfw.load('file://./model/', { size: 299 });
I'm asking because I noticed this in the README:
But because the link is incorrect, I'm not sure which is which.
The correct link for InceptionV2 is here:
Thank you!