Error when submitting assignment1

When creating a post, please add:
week-1 Advanced Computer Vision with TensorFlow

I get this error “Your model could not be loaded. Make sure it is a valid h5 file”. I have checked the naming. And that the file is valid.

1 Like

Hello @Katja_Sivertsen,

Could you try the below link once and follow the steps mentioned in the post comment. Once you do the fallback runtime, make sure to run the cells one by one from beginning till end and then download the model, and then submit the model.

Let me know if it resolves your issue.

Regards
DP

1 Like

I think it’s interesting for you to review this assignment with some importance, as it took me 4 hours to train and 3 hours to finish the assessment.

I love DeepLearning.AI, I have taken and continue to take countless courses with you and I have NEVER had any problems with any assignment. It would be an absurd generalization for me to consider this as something problematic, however, 7 hours of lost work is not easy. I will have to redo it from scratch and hope that the h5 file is correctly evaluated.

1 Like

Hello @andregalhardo

is your msg for me?? or to the learner?

Regards
DP

Hello @Deepti_Prasad,

thank you for helping us with the problem that I also encountered. I emphasize that I followed all the procedures you recommended (I selected use fallback version and the training took only a few minutes as you suggested). The birds.h5 file is correctly saved and to be on the safe side I created another model to check if indeed the file is saved correctly:

# define your model
model_2 = define_and_compile_model()
model_2.load_weights('birds.h5')

loss = model_2.evaluate(validation_dataset, steps=validation_steps)
print("Loss: ", loss)

And this code works. However, the problem of loading to Coursera remains. I tried opening a ticket there as well but received no response.
Thank you for any input.

1 Like

Hello @Luca_Macis,

Colab updated its default TF version to 2.11 and this had negative effects on labs that require uploading .h5 files. We’ve updated the assignments below to downgrade the TF version (v2.6) that works with the grader:

  • C3 - W1, W3
  • C4 - W2, W3

If you are getting a generic loading error from the grader, please check if you have these pip installs at the top:

# Install packages for compatibility with the autograder
!pip install tensorflow==2.6.0 --quiet
!pip install keras==2.6.0 --quiet

If not, then you might be working on an older version of the notebook. They can simply add the code above and then run all the cells again. Hopefully, the new output will then be graded correctly.

Let me know if it resolves your issue.

Regards
DP

1 Like

Hi @Deepti_Prasad,

It doesn’t work actually:

ERROR: Could not find a version that satisfies the requirement tensorflow==2.6.0 (from versions: 2.8.0rc0, 2.8.0rc1, 2.8.0, 2.8.1, 2.8.2, 2.8.3, 2.8.4, 2.9.0rc0, 2.9.0rc1, 2.9.0rc2, 2.9.0, 2.9.1, 2.9.2, 2.9.3, 2.10.0rc0, 2.10.0rc1, 2.10.0rc2, 2.10.0rc3, 2.10.0, 2.10.1, 2.11.0rc0, 2.11.0rc1, 2.11.0rc2, 2.11.0, 2.11.1, 2.12.0rc0, 2.12.0rc1, 2.12.0, 2.12.1, 2.13.0rc0, 2.13.0rc1, 2.13.0rc2, 2.13.0, 2.13.1, 2.14.0rc0, 2.14.0rc1, 2.14.0, 2.14.1, 2.15.0rc0, 2.15.0rc1, 2.15.0, 2.15.0.post1)
ERROR: No matching distribution found for tensorflow==2.6.0

Is there any other version that works with the autogravder?

1 Like

Lucas,

then one might have to check you file once for any codes correction. Kindly DM me your notebook, make sure you rename it as Luca_Macis Copy and then send it.

also can I know why are you used model_2???

in my assignment book the above code is already given and not part of grader cell and is mentioned as

Please save your model
model.save(“birds.h5”)

So I suppose you have either don’t editing in a cell you are not suppose to which can cause this loading model issue with the autogravder.

or if you have separately recalled the codes in the grader cell then, I sincerely suggest you save the copy of your assignment, get a fresh copy and add the codes only where it is mentioned ##YOUR CODE HERE. Other than that, no other place codes need to be written or any editing of the cell is allowed. Doing any of these can cause issue with autogravder and uploading of your model.

Regards
DP

1 Like

Hello @Luca_Macis

Error in codes

  1. for the below statement, please do not include activation to your code.
    def bounding_box_regression(x):

  2. There is a typo error in the model compile state, remove the extra comma.

Luca, make sure when download the file, keep model name as mentioned in the assignment.

File name should be birds.h5 when you are uploading for submission.

Once you do the correction, do the fallback runtime, then run each cell one by one, download the model and submit.

the pip install statement in your assignment shows 2.8 and was updated which is correct.

Let me know if it resolved the issue.

Regards
DP

2 Likes

@andregalhardo, the slowness is due to the fact that Google colab is no longer supporting GPU for the version of tensorflow we use in this assignment. To work around this, follow the steps @Deepti_Prasad mentioned above to use the Fallback Runtime - then you’ll be using the GPU and things will be much speedier.

For the long-term, the dev team is working on updating the assignment and grader to use a newer version of tensorflow.

2 Likes

Yes it did. Thank you @Deepti_Prasad!

1 Like