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

Broken with the recent file on next.js #807

Open
suhjohn opened this issue Dec 22, 2023 · 4 comments
Open

Broken with the recent file on next.js #807

suhjohn opened this issue Dec 22, 2023 · 4 comments

Comments

@suhjohn
Copy link

suhjohn commented Dec 22, 2023

Previous version was working fine with next.js. Somehow I think the update on the model on Cloudfront is making this fail.

@suhjohn
Copy link
Author

suhjohn commented Dec 22, 2023

I've done the following:

  1. Download the raw zip https://github.com/GantMan/nsfw_model/releases/tag/1.1.0
  2. Copy and paste the contents of web_model_quantized in my own s3 directory.
  3. Try to use that link

Results in the following error:

Error: layer: Improper config format: {"node":[{"name":"input","op":"Placeholder","attr":{"shape":{"shape":{"dim":[{"size":"-1"},{"size":"224"},{"size":"224"},{"size":"3"}]}},"dtype":{"type":"DTFLOAT"}}},{"name":"StatefulPartitionedCall/sequential/keras_layer/StatefulPartitionedCall/StatefulPartitionedCall/StatefulPartitionedCall/predict/MobilenetV2/Conv/Conv2D_weights","op":"Const","attr":{"value":{"tensor":{"dtype":"DTFLOAT","tensorShape":{"dim":[{"size":"3"},{"size":"3"},{"size":"3"},{"size":"48"}]}}},"dtype":{"type":"DTFLOAT"}}},{"name":"StatefulPartitionedCall/sequential/keras_layer/StatefulPartitionedCall/StatefulPartitionedCall/StatefulPartitionedCall/predict/MobilenetV2/expanded_conv_14/expand/Conv2D_bn_offset","op":"Const","attr":{"value":{"tensor":{"dtype":"DTFLOAT","tensorShape":{"dim":[{"size":"1344"}]}}},"dtype":{"type":"DTFLOAT"}}},{"name":"StatefulPartitionedCall/sequential/keras_layer/StatefulPartitionedCall/StatefulPartitionedCall/StatefulPartitionedCall/predict/MobilenetV2/Conv/Conv2D_bn_offset","op":"Const","attr":{"value":{"tensor":{"dtype":"DTFLOAT","tensorShape":{"dim":[{"size":"48"}]}}},"dtype":{"type":"DTFLOAT"}}},{"name":"StatefulPartitionedCall/sequential/keras_layer/StatefulPartitionedCall/StatefulPartitionedCall/StatefulPartitionedCall/predict/MobilenetV2/expanded_conv/depthwise/depthwise_weights","op":"Const","attr":{"value":{"tensor":{"dtype":"DTFLOAT","tensorShape":{"dim":[{"size":"3"},{"size":"3"},{"size":"48"},{"size":"1"}]}}},"dtype":{"type":"DTFLOAT"}}},{"name":"StatefulPartitionedCall/sequential/keras_layer/StatefulPartitionedCall/StatefulPartitionedCall/StatefulPartitionedCall/predict/MobilenetV2/expanded_conv/depthwise/depthwise_bn_offset","op":"Const","attr":{"value":{"tensor":{"dtype":"DTFLOAT","tensorShape":{"dim":[{"size":"48"}]}}},"dtype":{"type":"DTFLOAT"}}},{"name":"StatefulPartitionedCall/sequential/keras_layer/StatefulPartitionedCall/StatefulPartitionedCall/StatefulPartitionedCall/predict/MobilenetV2/expanded_conv/project/Conv2D_weights","op":"Const","attr":{"value":{"tensor":{"dtype":"DTFLOAT","tensorShape":{"dim":[{"size":"1"},{"size":"1"},{"size":"48"},{"size":"24"}]}}},"dtype":{"type":"DTFLOAT"}}},{"name":"StatefulPartitionedCall/sequential/keras_layer/StatefulPartitionedCall/StatefulPartitionedCall/StatefulPartitionedCall/predict/MobilenetV2/expanded_conv/project/Conv2D_bn_offset","op":"Const","attr":{"value":{"tensor":{"dtype":"DTFLOAT","tensorShape":{"dim":[{"size":"24"}]}}},"dtype":{"type":"DTFLOAT"}}},{"name":"StatefulPartitionedCall/sequential/keras_layer/StatefulPartitionedCall/StatefulPartitionedCall/StatefulPartitionedCall/predict/MobilenetV2/expanded_conv_1/expand/Conv2D_weights","op":"Const","attr":{"value":{"tensor":{"dtype":"DTFLOAT","tensorShape":{"dim":[{"size":"1"},{"size":"1"},{"size":"24"},{"size":"144"}]}}},"dtype":{"type":"DTFLOAT"}}},{"name":"StatefulPartitionedCall/sequential/keras_layer/StatefulPartitionedCall/StatefulPartitionedCall/StatefulPartitionedCall/predict/MobilenetV2/expanded_conv_14/depthwise/depthwise_weights","op":"Const","attr":{"value":{"tensor":{"dtype":"DTFLOAT","tensorShape":{"dim":[{"size":"3"},{"size":"3"},{"size":"1344"},{"size":"1"}]}}},"dtype":{"type":"DTFLOAT"}}},{"name":"StatefulPartitionedCall/sequential/keras_layer/StatefulPartitionedCall/StatefulPartitionedCall/StatefulPartitionedCall/predict/MobilenetV2/expanded_conv_1/expand/Conv2D_bn_offset","op":"Const","attr":{"value":{"tensor":{"dtype":"DTFLOAT","tensorShape":{"dim":[{"size":"144"}]}}},"dtype":{"type":"DTFLOAT"}}},{"name":"StatefulPartitionedCall/sequential/keras_layer/StatefulPartitionedCall/StatefulPartitionedCall/StatefulPartitionedCall/predict/MobilenetV2/expanded_conv_1/depthwise/depthwise_weights","op":"Const","attr":{"value":{"tensor":{"dtype":"DTFLOAT","tensorShape":{"dim":[{"size":"3"},{"size":"3"},{"size":"144"},{"size":"1"}]}}},"dtype":{"type":"DTFLOAT"}}},{"name":"StatefulPartitionedCall/sequential/keras_layer/StatefulPartitionedCall/StatefulPartitionedCall/StatefulPartitionedCall/predict/MobilenetV2/expanded_conv_1/depthwise/depthwise_bn_offset","op":"Const","attr":{"value":{"tensor":{"dtype":"DTFLOAT","tensorShape":{"dim":[{"size":"144"}]}}},"dtype":{"type":"DTFLOAT"}}},{"name":"StatefulPartitionedCall/sequential/keras_layer/StatefulPartitionedCall/StatefulPartitionedCall/StatefulPartitionedCall/predict/MobilenetV2/expanded_conv_1/project/Conv2D_weights","op":"Const","attr":{"value":{"tensor":{"dtype":"DTFLOAT","tensorShape":{"dim":[{"size":"1"},{"size":"1"},{"size":"144"},{"size":"32"}]}}},"dtype":{"type":"DTFLOAT"}}},{"name":"StatefulPartitionedCall/sequential/keras_layer/StatefulPartitionedCall/StatefulPartitionedCall/StatefulPartitionedCall/predict/MobilenetV2/expanded_conv_14/depthwise/depthwise_bn_offset","op":"Const","attr":{"value":{"tensor":{"dtype":"DTFLOAT","tensorShape":{"dim":[{"size":"1344"}]}}},"dtype":{"type":"DTFLOAT"}}},{"name":"StatefulPartitionedCall/sequential/keras_layer/StatefulPartitionedCall/StatefulPartitionedCa'className' and 'config' must set.

@hotgeart
Copy link

hotgeart commented Dec 22, 2023

CDN http://cloudfront.net/ is down : FetchError: request to https://d1zv2aa70wpiur.cloudfront.net/tfjs_quant_nsfw_mobilenet/model.json failed, reason: getaddrinfo ENOTFOUND d1zv2aa70wpiur.cloudfront.net

My logs :

2023-12-22T09:05:19.835173+00:00 app[web.1]: > [email protected] start
2023-12-22T09:05:19.835173+00:00 app[web.1]: > node server.js
2023-12-22T09:05:19.835173+00:00 app[web.1]:
2023-12-22T09:05:20.269873+00:00 app[web.1]: 2023-12-22 09:05:20.269767: I tensorflow/core/util/util.cc:169] oneDNN custom operations are on. You may see slightly different numerical results due to floating-point round-off errors from different computation orders. To turn them off, set the environment variable `TF_ENABLE_ONEDNN_OPTS=0`.
2023-12-22T09:05:20.305057+00:00 app[web.1]: 2023-12-22 09:05:20.304914: I tensorflow/core/platform/cpu_feature_guard.cc:193] This TensorFlow binary is optimized with oneAPI Deep Neural Network Library (oneDNN) to use the following CPU instructions in performance-critical operations:  AVX2 AVX512F AVX512_VNNI FMA
2023-12-22T09:05:20.305060+00:00 app[web.1]: To enable them in other operations, rebuild TensorFlow with the appropriate compiler flags.
2023-12-22T09:05:20.503512+00:00 app[web.1]:
2023-12-22T09:05:20.503513+00:00 app[web.1]: /app/node_modules/@tensorflow/tfjs-core/node_modules/node-fetch/lib/index.js:1491
2023-12-22T09:05:20.503515+00:00 app[web.1]: reject(new FetchError(`request to ${request.url} failed, reason: ${err.message}`, 'system', err));
2023-12-22T09:05:20.503515+00:00 app[web.1]: ^
2023-12-22T09:05:20.505376+00:00 app[web.1]: FetchError: request to https://d1zv2aa70wpiur.cloudfront.net/tfjs_quant_nsfw_mobilenet/model.json failed, reason: getaddrinfo ENOTFOUND d1zv2aa70wpiur.cloudfront.net
2023-12-22T09:05:20.505378+00:00 app[web.1]: at ClientRequest.<anonymous> (/app/node_modules/@tensorflow/tfjs-core/node_modules/node-fetch/lib/index.js:1491:11)
2023-12-22T09:05:20.505380+00:00 app[web.1]: at ClientRequest.emit (node:events:513:28)
2023-12-22T09:05:20.505381+00:00 app[web.1]: at TLSSocket.socketErrorListener (node:_http_client:494:9)
2023-12-22T09:05:20.505381+00:00 app[web.1]: at TLSSocket.emit (node:events:513:28)
2023-12-22T09:05:20.505381+00:00 app[web.1]: at emitErrorNT (node:internal/streams/destroy:157:8)
2023-12-22T09:05:20.505381+00:00 app[web.1]: at emitErrorCloseNT (node:internal/streams/destroy:122:3)
2023-12-22T09:05:20.505384+00:00 app[web.1]: at processTicksAndRejections (node:internal/process/task_queues:83:21) {
2023-12-22T09:05:20.505386+00:00 app[web.1]: type: 'system',
2023-12-22T09:05:20.505386+00:00 app[web.1]: errno: 'ENOTFOUND',
2023-12-22T09:05:20.505386+00:00 app[web.1]: code: 'ENOTFOUND'
2023-12-22T09:05:20.505386+00:00 app[web.1]: }
2023-12-22T09:05:20.606437+00:00 heroku[web.1]: Process exited with status 1
2023-12-22T09:05:20.628032+00:00 heroku[web.1]: State changed from starting to crashed

@GantMan
Copy link
Member

GantMan commented Dec 22, 2023

You can download the model here: https://github.com/infinitered/nsfwjs/tree/master/example/nsfw_demo/public/quant_mid

And point it at your own server. I'll see what's up with cloudfront and report back.

@GantMan
Copy link
Member

GantMan commented Dec 22, 2023

Ok, I paid the AWS bill 😄

To stop this in the future host your own copy:
https://github.com/infinitered/nsfwjs?tab=readme-ov-file#host-your-own-model

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

3 participants