patlevin / tfjs-to-tf

A TensorFlow.js Graph Model Converter
MIT License
136 stars 19 forks source link

error while converting tfjs model into tf saved_model format #38

Closed s91-maker closed 1 year ago

s91-maker commented 1 year ago

Hi I am converting one model.json (of tfjs format) into tf savedModel format and facing the below issue. Envirionment details- python 3.9.1, tensorflow=2.8.0, tensorflowjs=3.13.0. Below is the process/code that I followed-

import tfjs_graph_converter.api as tfjs
tfjs.graph_model_to_saved_model("models/model.json", 'savedmodel')
# error as below

ValueError: Depth of input (33686021) is not a multiple of input depth of filter (3) for '{{node model/tf_conv/sequential/conv2d/BiasAdd}} = _FusedConv2D[T=DT_FLOAT, data_format="NHWC", dilations=[1, 1, 1, 1], epsilon=0, explicit_paddings=[], fused_ops=["BiasAdd"], leakyrelu_alpha=0.2, num_args=1, padding="VALID", strides=[1, 2, 2, 1], use_cudnn_on_gpu=true, _device="/device:CPU:0"](model/tf_conv/sequential/tf_pad/Pad, Const_112:0, Const_113:0)' with input shapes: [33686019,33686342,33686342,33686021], [6,6,3,16], [16].

I have no information about the tf.js model. Can you please help me in finding the correct way of doing this. Or guide me where exactly it goes wrong (do I need to change version of any library OR did I miss any optional parameter while converting).

patlevin commented 1 year ago

This model (or processing it) seems to be broken. The input shape is reported to be ~33M^4 parameters, which would be ~1.2e30 parameters, or roughly 19 orders of magnitude larger than the largest models currently developed.

There seems to be something wrong with the model.json - is it possible for you to share the model.json file?

s91-maker commented 1 year ago

Sorry, it's not possible to share the model.json file. Even with tensorflow.js, the model.predict() is failing. Yes, something wrong with the model it seems. So, I have asked to retrain the model . Closing the issue as of now.

Thanks