I am trying to upload the birds.keras file to “My Submissions“ in Coursera. For some reason, I get the following error (pasted below). Basically, there is an additional argument ‘quantization_config‘ in tf.keras.layers.Dense() which is causing this issue.
Could anyone verify which keras version is being used to evaluate the model, since I think different versions of keras is likely causing this issue.*
Error:
Your model could not be loaded. Make sure it is a valid .keras file.
<class ‘keras.src.models.functional.Functional’> could not be deserialized properly. Please ensure that components that are Python object instances (layers, models, etc.) returned by `get_config()` are explicitly deserialized in the model’s `from_config()` method.
config={‘module’: ‘keras.src.models.functional’, ‘class_name’: ‘Functional’, ‘config’: {}, ‘registered_name’: ‘Functional’, ‘build_config’: {‘input_shape’: None}, ‘compile_config’: {‘optimizer’: {‘module’: ‘keras.optimizers’, ‘class_name’: ‘SGD’, ‘config’: {‘name’: ‘SGD’, ‘learning_rate’: 0.009999999776482582, ‘weight_decay’: None, ‘clipnorm’: None, ‘global_clipnorm’: None, ‘clipvalue’: None, ‘use_ema’: False, ‘ema_momentum’: 0.99, ‘ema_overwrite_frequency’: None, ‘loss_scale_factor’: None, ‘gradient_accumulation_steps’: None, ‘momentum’: 0.9, ‘nesterov’: False}, ‘registered_name’: None}, ‘loss’: ‘mse’, ‘loss_weights’: None, ‘metrics’: None, ‘weighted_metrics’: None, ‘run_eagerly’: False, ‘steps_per_execution’: 1, ‘jit_compile’: True}}.
Exception encountered: <class ‘keras.src.layers.core.dense.Dense’> could not be deserialized properly. Please ensure that components that are Python object instances (layers, models, etc.) returned by `get_config()` are explicitly deserialized in the model’s `from_config()` method.
config={‘module’: ‘keras.layers’, ‘class_name’: ‘Dense’, ‘config’: {‘name’: ‘dense’, ‘trainable’: True, ‘dtype’: {‘module’: ‘keras’, ‘class_name’: ‘DTypePolicy’, ‘config’: {‘name’: ‘float32’}, ‘registered_name’: None, ‘shared_object_id’: 139604691687840}, ‘units’: 1024, ‘activation’: ‘relu’, ‘use_bias’: True, ‘kernel_initializer’: {‘module’: ‘keras.initializers’, ‘class_name’: ‘GlorotUniform’, ‘config’: {‘seed’: None}, ‘registered_name’: None}, ‘bias_initializer’: {‘module’: ‘keras.initializers’, ‘class_name’: ‘Zeros’, ‘config’: {}, ‘registered_name’: None}, ‘kernel_regularizer’: None, ‘bias_regularizer’: None, ‘kernel_constraint’: None, ‘bias_constraint’: None, ‘quantization_config’: None}, ‘registered_name’: None, ‘build_config’: {‘input_shape’: [None, 1280]}, ‘name’: ‘dense’, ‘inbound_nodes’: [{‘args’: [{‘class_name’: ‘_keras_tensor_’, ‘config’: {‘shape’: [None, 1280], ‘dtype’: ‘float32’, ‘keras_history’: [‘flatten’, 0, 0]}}], ‘kwargs’: {}}]}.
Exception encountered: Error when deserializing class ‘Dense’ using config={‘name’: ‘dense’, ‘trainable’: True, ‘dtype’: ‘float32’, ‘units’: 1024, ‘activation’: ‘relu’, ‘use_bias’: True, ‘kernel_initializer’: {‘module’: ‘keras.initializers’, ‘class_name’: ‘GlorotUniform’, ‘config’: {‘seed’: None}, ‘registered_name’: None}, ‘bias_initializer’: {‘module’: ‘keras.initializers’, ‘class_name’: ‘Zeros’, ‘config’: {}, ‘registered_name’: None}, ‘kernel_regularizer’: None, ‘bias_regularizer’: None, ‘kernel_constraint’: None, ‘bias_constraint’: None, ‘quantization_config’: None}.
Exception encountered: Unrecognized keyword arguments passed to Dense: {‘quantization_config’: None}*