python – How do I solve TypeError: (‘Keyword argument not understood:’, ‘groups’)?

After training my CNN models I’m trying to load them like so:

modelo_prueba = tf.keras.models.load_model('gallerydata/Modelos/M2_MinstrelInTheGallery.h5')
modelo_prueba_sr = tf.keras.models.load_model('gallerydata/Modelos/M2_MinstrelInTheGallery_SinRegu.h5')
modelo_prueba_3 = tf.keras.models.load_model('gallerydata/Modelos/M3_MinstrelInTheGallery.h5')

but I get the following error:

TypeError                                 Traceback (most recent call last)
<ipython-input-2-05eba12555fc> in <module>
----> 1 modelo_prueba = tf.keras.models.load_model('gallerydata/Modelos/M2_MinstrelInTheGallery.h5')
      2 modelo_prueba_sr = tf.keras.models.load_model('gallerydata/Modelos/M2_MinstrelInTheGallery_SinRegu.h5')
      3 modelo_prueba_3 = tf.keras.models.load_model('gallerydata/Modelos/M3_MinstrelInTheGallery.h5')

~Miniconda3envskeras_envlibsite-packagestensorflow_corepythonkerassavingsave.py in load_model(filepath, custom_objects, compile)
    144   if (h5py is not None and (
    145       isinstance(filepath, h5py.File) or h5py.is_hdf5(filepath))):
--> 146     return hdf5_format.load_model_from_hdf5(filepath, custom_objects, compile)
    147 
    148   if isinstance(filepath, six.string_types):

~Miniconda3envskeras_envlibsite-packagestensorflow_corepythonkerassavinghdf5_format.py in load_model_from_hdf5(filepath, custom_objects, compile)
    166     model_config = json.loads(model_config.decode('utf-8'))
    167     model = model_config_lib.model_from_config(model_config,
--> 168                                                custom_objects=custom_objects)
    169 
    170     # set weights

~Miniconda3envskeras_envlibsite-packagestensorflow_corepythonkerassavingmodel_config.py in model_from_config(config, custom_objects)
     53                     '`Sequential.from_config(config)`?')
     54   from tensorflow.python.keras.layers import deserialize  # pylint: disable=g-import-not-at-top
---> 55   return deserialize(config, custom_objects=custom_objects)
     56 
     57 

~Miniconda3envskeras_envlibsite-packagestensorflow_corepythonkeraslayersserialization.py in deserialize(config, custom_objects)
    104       module_objects=globs,
    105       custom_objects=custom_objects,
--> 106       printable_module_name='layer')

~Miniconda3envskeras_envlibsite-packagestensorflow_corepythonkerasutilsgeneric_utils.py in deserialize_keras_object(identifier, module_objects, custom_objects, printable_module_name)
    301             custom_objects=dict(
    302                 list(_GLOBAL_CUSTOM_OBJECTS.items()) +
--> 303                 list(custom_objects.items())))
    304       with CustomObjectScope(custom_objects):
    305         return cls.from_config(cls_config)

~Miniconda3envskeras_envlibsite-packagestensorflow_corepythonkerasenginesequential.py in from_config(cls, config, custom_objects)
    375     for layer_config in layer_configs:
    376       layer = layer_module.deserialize(layer_config,
--> 377                                        custom_objects=custom_objects)
    378       model.add(layer)
    379     if not model.inputs and build_input_shape:

~Miniconda3envskeras_envlibsite-packagestensorflow_corepythonkeraslayersserialization.py in deserialize(config, custom_objects)
    104       module_objects=globs,
    105       custom_objects=custom_objects,
--> 106       printable_module_name='layer')

~Miniconda3envskeras_envlibsite-packagestensorflow_corepythonkerasutilsgeneric_utils.py in deserialize_keras_object(identifier, module_objects, custom_objects, printable_module_name)
    303                 list(custom_objects.items())))
    304       with CustomObjectScope(custom_objects):
--> 305         return cls.from_config(cls_config)
    306     else:
    307       # Then `cls` may be a function returning a class.

~Miniconda3envskeras_envlibsite-packagestensorflow_corepythonkerasenginebase_layer.py in from_config(cls, config)
    517         A layer instance.
    518     """
--> 519     return cls(**config)
    520 
    521   def compute_output_shape(self, input_shape):

~Miniconda3envskeras_envlibsite-packagestensorflow_corepythonkeraslayersconvolutional.py in __init__(self, filters, kernel_size, strides, padding, data_format, dilation_rate, activation, use_bias, kernel_initializer, bias_initializer, kernel_regularizer, bias_regularizer, activity_regularizer, kernel_constraint, bias_constraint, **kwargs)
    525         kernel_constraint=constraints.get(kernel_constraint),
    526         bias_constraint=constraints.get(bias_constraint),
--> 527         **kwargs)
    528 
    529 

~Miniconda3envskeras_envlibsite-packagestensorflow_corepythonkeraslayersconvolutional.py in __init__(self, rank, filters, kernel_size, strides, padding, data_format, dilation_rate, activation, use_bias, kernel_initializer, bias_initializer, kernel_regularizer, bias_regularizer, activity_regularizer, kernel_constraint, bias_constraint, trainable, name, **kwargs)
    120         name=name,
    121         activity_regularizer=regularizers.get(activity_regularizer),
--> 122         **kwargs)
    123     self.rank = rank
    124     self.filters = filters

~Miniconda3envskeras_envlibsite-packagestensorflow_corepythontrainingtrackingbase.py in _method_wrapper(self, *args, **kwargs)
    455     self._self_setattr_tracking = False  # pylint: disable=protected-access
    456     try:
--> 457       result = method(self, *args, **kwargs)
    458     finally:
    459       self._self_setattr_tracking = previous_value  # pylint: disable=protected-access

~Miniconda3envskeras_envlibsite-packagestensorflow_corepythonkerasenginebase_layer.py in __init__(self, trainable, name, dtype, dynamic, **kwargs)
    184     }
    185     # Validate optional keyword arguments.
--> 186     generic_utils.validate_kwargs(kwargs, allowed_kwargs)
    187 
    188     # Mutable properties

~Miniconda3envskeras_envlibsite-packagestensorflow_corepythonkerasutilsgeneric_utils.py in validate_kwargs(kwargs, allowed_kwargs, error_message)
    716   for kwarg in kwargs:
    717     if kwarg not in allowed_kwargs:
--> 718       raise TypeError(error_message, kwarg)

TypeError: ('Keyword argument not understood:', 'groups')

I don`t really know what’s causing the error. It’s a college project and both me and my partner have the same version of everything (which seems to be the problem according to some Google search) but it works for him.

Any help? Thank you.