Cannot load .h5 model

I just created a model in Teachable Machine and downloaded it to hard form, which is .h5. But when I call it in Colab, I get an error. Whereas last week I tried it and it was fine. The error like this:

TypeError: Error when deserializing class ‘DepthwiseConv2D’ using config={‘name’: ‘block_1_depthwise_conv’, ‘trainable’: True, ‘dtype’: ‘float32’, ‘kernel_size’: [3, 3], ‘strides’: [1, 1], ‘padding’: ‘same’, ‘data_format’: ‘channels_last’, ‘dilation_rate’: [1, 1], ‘groups’: 1, ‘activation’: ‘linear’, ‘use_bias’: False, ‘bias_initializer’: {‘module’: ‘keras.initializers’, ‘class_name’: ‘Zeros’, ‘config’: {}, ‘registered_name’: None}, ‘bias_regularizer’: None, ‘activity_regularizer’: None, ‘bias_constraint’: None, ‘depth_multiplier’: 1, ‘depthwise_initializer’: {‘module’: ‘keras.initializers’, ‘class_name’: ‘GlorotUniform’, ‘config’: {‘seed’: None}, ‘registered_name’: None}, ‘depthwise_regularizer’: None, ‘depthwise_constraint’: None}.

Exception encountered: Unrecognized keyword arguments passed to DepthwiseConv2D: {‘groups’: 1}

Hello @Higan_1105, the error says that the keyword ‘groups’ is not recognized. Have you tried deleting it from the h5-file?
Which tensorflow-version are you running?

How to delete keyword “groups” in the model? I make the model with teachable machine and use default settings

The latest version of TensorFlow, which is 2.17.0

Under this URL if found this solution:

# hack to change model config from keras 2->3 compliant
import h5py
f = h5py.File("/content/old_keras_model.h5", mode="r+")
model_config_string = f.attrs.get("model_config")
if model_config_string.find('"groups": 1,') != -1:
    model_config_string = model_config_string.replace('"groups": 1,', '')
    f.attrs.modify('model_config', model_config_string)
    f.flush()
    model_config_string = f.attrs.get("model_config")
    assert model_config_string.find('"groups": 1,') == -1

f.close()

Ooh thank you, let me try it

it works!!
Thanks a lot