C3W3_Programming Assignment: Question Duplicates

  • Week #3
  • Question Duplicates | Coursera
  • I saved the Siamese model with: model.save(filepath=‘siamese.keras’). I am trying to load the model with: load_siamese_model = tf.keras.models.load_model(‘siamese.keras’, safe_mode=False, compile=False) but i got: ValueError: Sequential model ‘sequential’ has already been configured to use input shape (None, 1). You cannot build it with input_shape [None, 1]
    Here is the model.input_shape [(None, 1), (None, 1)]
1 Like

Can you share the screenshot of the error

Was there a model.save step in the assignment?


No there was not. I save it because i want to deploy it.

1 Like

1 Like

So you wrote separate codes for this step in your local jupyter or Coursera provided jupyter environment?

Yes, i wrote on my local jupyter.

1 Like

It’s a little hard for us to help you with your local IT problems, but one possibility is that this is a “versionitis” problem between the version of TF being used on the Coursera site and the version you have locally. E.g. maybe they changed the “save” format between the two versions. Since it looks like you are already sophisticated enough to know about Anaconda, maybe you can try checking the TF versions in both places and you can figure out how to use the same version locally.

print(tf.__version__)

should be enough to at least see if this is a possible cause of the problem or not.

1 Like

Okay i will try it. Thank you for your time.

1 Like

It’s a general issue here that most of the courses just get published at some point in time, which means that they are using the versions of TF, numpy and all the hundreds of python packages that were current at that point in time. They don’t get updated every time TF or numpy changes versions. If you come along two years later and try to download things, there is no guarantee that things will “just work”: this software world is very dynamic. You’d think that if they were going to change things, they would do so in ways that are “backwards compatible”, but the evidence suggests that this is not a big consideration for them for whatever reason. :grinning:

We don’t have any “official” instructions for this kind of issue, because it’s just too complicated to cover all possible cases. But here’s a thread from a fellow student that gives some guidance about how to get started. Given that you already know about Anaconda, some of that may be “old news” to you. :nerd_face:

1 Like

Hello @Menna_Hefny

I hope the issue is resolved as you have selected solution for this topic.

Regards
DP