C3W1_Bird_Box_Assignment

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}*

Are you solving this Lab in the paltform or on the local computer?

check the tf and keras version your codes are working upon. is it working on the version codes were written or on latest version?

thanks for mentioning this, I was actually using tensorflow.keras which had latest version rather than the specific version I installed. I tried submitting it again and this time it pulled through. Thanks!

platform..

I am also receiving the same problem in the autograder. Is there anything that has to be changed in specific?

Try using tf-keras (2.18) instead of tf.keras because tf.keras installs the latest version of keras librabry which is not used by the grader.

Hello **Harsh_Patel12, I got the same error message, I followed your solution but it still failed but this time with a different error message

Grader Error: Grader feedback truncated**

Grader feedback was truncated due to size limits. Visit the Discussion Forums to see if your peers are experiencing or have found resolutions for similar errors. If the error isn’t resolved in 24 hours, please reach out to Coursera through our Help Center.

This is the JavaScript error message
:rocket: https://careers.coursera.com

/api/userPreferences.v1/38548694~HONORS:1 Failed to load resource: the server responded with a status of 404 ()

Understand this error
/api/onDemandWorkspaceLaunchers.v2/38548694~Yv0LMhL1EeuABgpVBjPnkw~VJ6DV?fields=id,userId,courseId,itemId,templateId,isStandardSubmission,isFileBrowserEnabled,description,offlineInstructions,sharedWorkspaceUrl,label,shareConfig,inLabInstructionsParts,contentPath,imageApplicationType,versionedAtomId,workspaceLauncherId:1 Failed to load resource: the server responded with a status of 400 ()Understand this error
console.js:36 [pendo] initialized with data: {“visitor”:{“id”:“17e22d312a18d16dcdfe565a783f8353”,“isStaff”:false,“isSuperuser”:false,“courseId”:“Yv0LMhL1EeuABgpVBjPnkw”,“context”:“course_frame”}}
submission:1 [Intervention] Slow network is detected. See Chrome Platform Status for more details. Fallback font will be used while loading: https://d3njjcbhbojbot.cloudfront.net/web/bundles/styleguide/icons/fonts/coursera.v26.woff

data.pendo.io/data/ptm.gif/bfe8c8aa-f7a6-46f4-5ede-db5a212ce2cc?v=2.317.2_prod-io&ct=1775282870901&jzb=eJzFV1Fv2zYQ_isCn61IlCNZ1ptdJ1iKGO3WIFtQBAYtUTJriVRISrIz5Hftfb-sRypI4gbpktbu_GKTPN733fHz8fj5b6S3NUUJSkuWrtEALaXoFJULzSqYxqNRGMRBfDweh-EAtUwxLeSCZbADj2gQZEMcEBxnOMrSLKdhFJJRPMzjYTgEZyRNRcO1tedNWQ5QI0vYutK6VonndV13BBYSAMmRkIVXUiK5R7KW8JRmbiqqutFUugZYcLdjeuVqypWQeSk6r5aikKSqGC-8y_fR7NJbMpm5S7GhylPNsmLK7AMmYFkrlEC4RBZU978KoPLbyWR28gdY2JjgOy3BzvzQTJeQgp430Vqa_XcDVG3PeEY3KPHBeMXK7HGoN-AZfXxk5UyAQMErynXiTIGbMzXcLuTWmRSEcefffxzfw77v1IJxrRwTP82uRONUjdJ26MDyUxMtnJoodXTKJFg8SYEDsxbMxEskYJ6UtHoMdXZ2-SzOVCkXt7dFQI9_LOS3ANU8rXF4eByNCz9aHh4njHNykx8EpwJxgPy5hm8qd1DTqIy7X3BawQ0P1_VLOCgjmsB_UWm7k2lauVqI0q0Jp6Vbkq1otPsQBqD2K-DP7uwH904fZ9xCiqZ2rc9E4jjZsX-YH38zr9itKWL4yEf7SwAeh8dtIL6fgSesX4wmY5Km2hQiKH1CsltzrruZeB73_uKQrGrHwf4Ocp8pjm_SDhc_xW1PdF5xzP8p1-gFuY4OLdf_Q6MQ7B6vhmzd4ZvXFDW8iwPDNwluGRI_NwX1NYLbKV_QGO0E_JNENqOQRur7RPreyM3hgqdu4AcRbNayob9ENQ9ZuGcBnUbLMriM9gMuU_eddXzYmwxg5lRDPIX6U5K6tpfp_vFgEVJjW9a-Rr6lkXydkqYfZlc_1Kd-6_7u-WeA8hIyhJLPqKS5RtdmqidxQZZnD-277gdoPCu76K9Wrsa3p9EymgMNK1K7iE_Xq647FcTffKrm7z_BIm3BE_TFkH7NqNXYYqGKxcL8un9VVHBMRnhmihRgv1j0yrMRX7X--Xx1jk9oM5kW9eX0y0e-hj-kIaqobfMtODkf_Z6v52syD4YfJl-Muhpts5iuCLdFHM1srTM6VvSmofDUQMkYnj5bkDxKhsNhbMKB_lsSUxEv4IVkU5NRkr2z76Tru-uvFDRLAA:1 Failed to load resource: net::ERR_SOCKET_NOT_CONNECTED

Yeah I received the same error and someone told me to reduce the size of the model by limiting the layers.

I still haven’t tried it yet so can’t comment if it will pull through or not..

I am working on the assignment, submitted 7 times and have problems with the file and it gave this error. Can help with how we can get it back to work. I am pretty sure it’s nothing to do with my code. Here’s the error:
”Your model could not be loaded. Make sure it is a valid .keras file."

{mentor edit: removed a wall of text, while retaining the key error message.}

There is a issue with the grader. It has to do with the keras version. Please make your C3W1_Assignment.ipynb to work as well. Thanks. Appreciate your response on this.

Why don’t you guys restore the original version and work around the solution again, you can do that from the question mark on the the top right corner in Coursera or the 3 dots in the top right corner in DLAI platform!

Make sure you rename or delete the current file you are working one before you restore the original file.

@gent.spah

tf3 course is only available on Coursera platform.

This clearly looks a module version issue. learners who are running codes in latest version of tf and keras version are facing this issue. they need to run in it in 2.18 version

I think @chris.favila mentioned he is working on this, and will only update by Monday.

So wait for his update.

Regards

Dr. Deepti

Hi everyone. As Bernard mentioned, there is a compatibility issue with the Keras version that Colab recently updated to. It results in this error message when the grader tries to load your model:

Your model could not be loaded. Make sure it is a valid .keras file

The affected assignments are:

  • C3W1
  • C3W3
  • C4W2
  • C4W3

These notebooks have now been updated to rollback the Keras version. You can reopen them from the classroom. If you don’t want to rewrite your solution, you can simply add this to your old notebook (in the pip install cell before the imports):

!pip install keras==3.9.0

We’ll check if there are also effects on the other assignments this coming week.

Hope this helps and thank you for reporting the issue!

Thank you for the note, Chris. It has been solved on my end for the first assignment. I will look out for the rest.