One solution to outstanding "Model submission is invalid" bug

The issue with the grader outputting " Model submission is invalid" when using Tensorflow 2.X seems to be a two year old bug with the Week 3 assignment.

If the keepers of the course could resolve this issue that would be great as it seems to have resulted in many learners wasting hours trying to find the correct version of tensorflow and tensorflowjs.

In lieu of this issue being resolved, I just wanted to share what modifications worked for me in Colab:

!pip install tensorflow==1.14.0
!pip install --no-deps tensorflowjs
!pip install tensorflow_hub

I also added the code below when importing tensorflow.

%tensorflow_version 1.x   #forces colab to use tensorflow version 1.X
import tensorflow as tf

Copying Toto Budi Trapsilo’s post:

Apparently, the grading system will not accept a model created using the latest version of tensorflow and will mark the model as “invalid model”. I do not really know why. By using tensorflow version 1.x I passed the assignment on a single try, compared to 4 failed attempts I try using tensorflow version 2.4.1.

Hopefully this helps other learners while this bug remains unresolved.

1 Like

Hi @dzubke,

Thanks for sharing how you worked around the issue.

You are welcome, @Jean_de. Thank you for acknowledging my post.

Do you know if there are any efforts to resolve this issue, or at least, are the relevant people at DeepLearning.ai award of the bug?

Hi, @dzubke! :wave:

I made sure that the issue will get attention. Thank you again for posting the workaround!

2 Likes

Thank you @yurij!

I think many other learners will appreciate your efforts to help resolve this issue.

1 Like

As per the latest version of the notebook, the following packages should get you a passing grade. Accuracy on the test set should be > 70% to pass the assignment.

!pip install tensorflow==2.2
!pip install --no-deps tensorflowjs
!pip install tensorflow_hub
1 Like

No, the bug is still there.

1 Like

Any fixes for the bug? I’m unable to install the 1.14.0 version and I keep getting the bug with 73% accuracy

1 Like

After a lot of trial and error, it worked when I specified the version of tensorflowjs (2.0):

!pip install tensorflow==2.2
!pip install tensorflowjs==2.0

I’m using colab and also getting the “Model submission is invalid” error even though the accuracy is > 70%.

!pip install tensorflow==2.2
!pip install tensorflowjs==2.0
import tensorflow as tf
print('\u2022 Using TensorFlow Version:', tf.__version__)

• Using TensorFlow Version: 2.11.0

Any suggestions on how to force using version 2.2 not 2.11.0?

Hello all

So, I am getting the “The model in your submission is invalid. Please try again!” error. I have tried all the above solutions, however none have worked. I am working on tensorflow 2.2 and tensorflowjs 2.0, with an accuracy above 70%.

Any suggestions?

open model.json in your favourite code editor, change the value :
generatedBy : “keras v2.2.0-tf”
keras_version : “2.2.0-tf”

You dont need to re-train the model

try this :
open model.json in your favourite code editor, change the value :
generatedBy : “keras v2.2.0-tf”
keras_version : “2.2.0-tf”

You dont need to re-train the model

2 Likes

I tried so many options in Colab, but I wasn’t able to convert the model in compatible format to pass throug this assignment. My Colab Notebook crashed so many times due to my trials… What worked for me at the end was following:

  • In Colab I savedH5 model only, then I downloaded it to my local computer
  • I installed Python 3.8 (64 bit version) in my Win
  • I used pip3 to do following:
pip3 install tensorflow==2.2
pip3 install tensorflowjs

Note: There were still some dependecy errors, but it was still ok to convert the model

Then I was able to use tensorflow_convert to create the required output from my H5 model I downloaded in the first step.

When I look in my JSON file (model.json) I see following at the beginning:

“generatedBy”: “keras v2.3.0-tf”, “convertedBy”: “TensorFlow.js Converter v3.19.0”

… and with this I passed couple of minutes ago. Hope it helps to anyone who is struggling to complete this simple assignment.
Good luck!

Additional to the comments shared here, I had to define the tensorflow-cpu package version.

!pip install tensorflow-cpu==2.2.0
!pip install tensorflowjs==2.0
!pip install keras==2.2.0
!pip install tensorflow==2.2.0

This worked for me

May be you need to restart the colab and then install the 2.2 version

When I use this config in colab, I am getting

ModuleNotFoundError: No module named ‘tensorflow_decision_forests’

while running tensorflowjs_converter. I then installed ‘tensorflow_decision_forests’ and it worked. Thanks!!