ValueError: Layer 'conv2d_4' expected 2 variables, but received 0 variables during loading. Expected: ['conv2d_4/kernel:0', 'conv2d_4/bias:0']

at local level it successfully runs but when deployed an error appears like this ValueError: Layer ‘conv2d_4’ expected 2 variables, but received 0 variables during loading. Expected: [‘conv2d_4/kernel:0’, ‘conv2d_4/bias:0’]

repo link:

Hi @8shagrid

Have you tried matching the exact version number for libraries used in the app on your local computer versus on the deployed server.

pip freeze

The same is happening to me

ValueError: Layer 'conv2d' expected 2 variables, but received 0 variables during loading. Expected: ['conv2d/kernel:0', 'conv2d/bias:0']

I trained the model on colab(for faster runtime) but after downloading the model and running it on my local machine it gives this.

my best guess is there is a compatibility issue between colab and my local machine, i guess ill retrain on my local machine even tough it would take 30 min to an hour

Saving broken between tf.keras and Keras Core · Issue #855 · keras-team/keras-core · GitHub

Nevermind its fixed here, if you are using an earlier model of keras use get_weights and set_weights to get it fixed

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.