Error: FusedConv2d and DepthwiseConv2d with BiasAdd must have one extra argument: bias
I keep getting Error: FusedConv2d and DepthwiseConv2d with BiasAdd must have one extra argument: bias. when I try model.predict() on a MobileNet model.
The model looks like this in Python (Kaggle notebooks):
layer = hub.KerasLayer("https://tfhub.dev/google/imagenet/mobilenet_v3_large_100_224/feature_vector/5",
trainable=False, input_shape=(224, 224, 3))
model = tf.keras.Sequential([
normalization_layer,
layer,
tf.keras.layers.Dense(len(class_names), activation="softmax")
])
model.compile(
optimizer=tf.keras.optimizers.Adam(),
loss=tf.keras.losses.SparseCategoricalCrossentropy(from_logits=True),
metrics=['acc'])
history = model.fit(train_ds,
validation_data=val_ds,
epochs=2)
model.save("model")
The converter command (another notebook):
tensorflowjs_converter \
--input_format=tf_saved_model \
--output_format=tfjs_graph_model \
--signature_name=serving_default \
--saved_model_tags=serve \
[model path] \
web_model
The JS code (my machine) :
const model = await tf.loadGraphModel("file://" + __dirname + "/web_model/model.json") console.log(new Array(...(await modelPromise).predict(tf.node.decodeImage(blob).resizeBilinear([224,224]).expandDims(0)).dataSync()))
Stack trace:
Error: FusedConv2d and DepthwiseConv2d with BiasAdd must have one extra argument: bias.
at fusedConvAndDepthWiseParams (/Users/stackoverflow/Desktop/jsmodel/node_modules/@tensorflow/tfjs-converter/dist/tf-converter.node.js:27747:19)
at executeOp$g (/Users/stackoverflow/Desktop/jsmodel/node_modules/@tensorflow/tfjs-converter/dist/tf-converter.node.js:27795:22)
at /Users/stackoverflow/Desktop/jsmodel/node_modules/@tensorflow/tfjs-converter/dist/tf-converter.node.js:28975:65
at /Users/stackoverflow/Desktop/jsmodel/node_modules/@tensorflow/tfjs-core/dist/tf-core.node.js:4441:22
at Engine.scopedRun (/Users/stackoverflow/Desktop/jsmodel/node_modules/@tensorflow/tfjs-core/dist/tf-core.node.js:4451:23)
at Engine.tidy (/Users/stackoverflow/Desktop/jsmodel/node_modules/@tensorflow/tfjs-core/dist/tf-core.node.js:4440:21)
at Object.tidy (/Users/stackoverflow/Desktop/jsmodel/node_modules/@tensorflow/tfjs-core/dist/tf-core.node.js:8901:19)
at /Users/stackoverflow/Desktop/jsmodel/node_modules/@tensorflow/tfjs-converter/dist/tf-converter.node.js:28975:39
at executeOp (/Users/stackoverflow/Desktop/jsmodel/node_modules/@tensorflow/tfjs-converter/dist/tf-converter.node.js:29019:7)
at /Users/stackoverflow/Desktop/jsmodel/node_modules/@tensorflow/tfjs-converter/dist/tf-converter.node.js:29513:35
@okyanusoz did you get chance to check the related issue here https://github.com/tensorflow/tfjs/issues/5013 , could you please share the version of tfjs and python ?
Yes, I did. I tried updating TensorFlow.js, but to no avail. Here's my environment:
The training notebook: Python 3.7.12 TensorFlow 2.6.4
The JS conversion notebook: Python 3.7.12 TensorFlow 2.6.4 TensorFlow.js converter (tensorflowjs) 3.18.0
JS code (my machine): TensorFlow.js (tfjs-node) 3.18.0 Node.js 14.17.1
When I use another model like PNasNet, this doesn't happen.
@okyanusoz Can you share the saved model? I can't run your code to generate the model since you didn't provide all the values
This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 7 days if no further activity occurs. Thank you.
Closing as stale. Please @mention us if this needs more attention.