-
Notifications
You must be signed in to change notification settings - Fork 539
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
Error: Could not load the model. Make sure you are importing the model.min.js bundle. #863
Comments
Hi, did you find a fix for this? Currently facing the same issue |
When will this problem be fixed? I've encountered it too. |
Same here with a Ionic/Angular project (only on production) |
I am having the same issue in my Nuxt 3 (with spa mode) project. It throws an error right after this line: import * as tf from "@tensorflow/tfjs";
import * as nsfwjs from "nsfwjs"; Any solutions? nsfwjs.js?v=0f6cacb3:217 Uncaught (in promise) Error: Could not load the model. Make sure you are importing the model.min.js bundle.
at nsfwjs.js?v=0f6cacb3:217:17
at step (nsfwjs.js?v=0f6cacb3:110:17)
at Object.next (nsfwjs.js?v=0f6cacb3:62:14)
at nsfwjs.js?v=0f6cacb3:49:67
at new Promise (<anonymous>)
at __awaiter (nsfwjs.js?v=0f6cacb3:31:10)
at loadModel (nsfwjs.js?v=0f6cacb3:195:10)
at Module.<anonymous> (nsfwjs.js?v=0f6cacb3:249:22)
at step (nsfwjs.js?v=0f6cacb3:110:17)
at Object.next (nsfwjs.js?v=0f6cacb3:62:14) |
Found a solution to my problem. Instead of this as per docs: const model = nsfwjs.load("/nsfw_models/inception_v3/", { type: "graph" }); Use this one: const model = await nsfwjs.load("/nsfw_models/inception_v3/", { size: 299 }); Same thing for const availableModels: ModelConfig = {
MobileNetV2: { path: "mobilenet_v2", numOfWeightBundles: 1 },
MobileNetV2Mid: {
path: "mobilenet_v2_mid",
numOfWeightBundles: 2,
options: { type: "graph" },
},
InceptionV3: {
path: "inception_v3",
numOfWeightBundles: 6,
options: { size: 299 },
},
}; If you are running a bundling issues with vite, just download import * as nsfwjs from "@/utils/nsfwjs" // nsfwjs contain .ts and .js |
I have a Vite project and I'm getting the following error when installing the library in version: ^4.1.0. I followed the documentation but apparently Vite has some issues. Does anyone know how I can solve this?
nsfwjs.js?v=168f040f:67180 Uncaught (in promise)
Error: Could not load the model. Make sure you are importing the model.min.js bundle.
at nsfwjs.js?v=168f040f:67180:17
at step4 (nsfwjs.js?v=168f040f:67073:18)
at Object.next (nsfwjs.js?v=168f040f:67025:14)
at nsfwjs.js?v=168f040f:67012:70
at new Promise ()
at __awaiter (nsfwjs.js?v=168f040f:66994:10)
at loadModel (nsfwjs.js?v=168f040f:67158:10)
at Module. (nsfwjs.js?v=168f040f:67212:22)
at step4 (nsfwjs.js?v=168f040f:67073:18)
at Object.next (nsfwjs.js?v=168f040f:67025:14)
The text was updated successfully, but these errors were encountered: