Week 3 assignment 1 [w3.] Exercice 2

Hi,

I’ve completed both the first and second exercices and passed through all tests. whoever when I look at

summary(model)

[[‘InputLayer’, [(None, 30, 37)], 0],
[‘InputLayer’, [(None, 64)], 0],
[‘Bidirectional’, (None, 30, 64), 17920],
[‘RepeatVector’, (None, 30, 64), 0, 30],
[‘Concatenate’, (None, 30, 128), 0],
[‘Dense’, (None, 30, 10), 1290, ‘tanh’],
[‘Dense’, (None, 30, 1), 11, ‘relu’],
[‘Activation’, (None, 30, 1), 0],
[‘Dot’, (None, 1, 64), 0],
[‘InputLayer’, [(None, 64)], 0],
[‘LSTM’,
[(None, 64), (None, 64), (None, 64)],
33024,
[(None, 1, 64), (None, 64), (None, 64)],
‘tanh’],
[‘Dense’, (None, 11), 715, ‘softmax’],
[‘Dense’, (None, 11), 715, ‘softmax’],
[‘Dense’, (None, 11), 715, ‘softmax’],
[‘Dense’, (None, 11), 715, ‘softmax’],
[‘Dense’, (None, 11), 715, ‘softmax’],
[‘Dense’, (None, 11), 715, ‘softmax’],
[‘Dense’, (None, 11), 715, ‘softmax’],
[‘Dense’, (None, 11), 715, ‘softmax’],
[‘Dense’, (None, 11), 715, ‘softmax’]]

Also, I get a Total params= 59,395 and Trainable params= 59,395.
And when I run this cell

model.load_weights('models/model.h5')

I get the following error message:

ValueError Traceback (most recent call last)
in
----> 1 model.load_weights(‘models/model.h5’)

/opt/conda/lib/python3.7/site-packages/tensorflow/python/keras/engine/training.py in load_weights(self, filepath, by_name, skip_mismatch, options)
2209 f, self.layers, skip_mismatch=skip_mismatch)
2210 else:
→ 2211 hdf5_format.load_weights_from_hdf5_group(f, self.layers)
2212
2213 def _updated_config(self):

/opt/conda/lib/python3.7/site-packages/tensorflow/python/keras/saving/hdf5_format.py in load_weights_from_hdf5_group(f, layers)
684 ‘containing ’ + str(len(layer_names)) +
685 ’ layers into a model with ’ + str(len(filtered_layers)) +
→ 686 ’ layers.’)
687
688 # We batch weight value assignments in a single backend call

ValueError: You are trying to load a weight file containing 5 layers into a model with 14 layers.

If someone could look at this it would be great.
Thanks

You have most likely not passed the modelf test, which is the cell under where you define modelf. You also see the expected summary in the test here:

expected_summary = [['InputLayer', [(None, 30, 37)], 0],
                         ['InputLayer', [(None, 64)], 0],
                         ['Bidirectional', (None, 30, 64), 17920],
                         ['RepeatVector', (None, 30, 64), 0, 30],
                         ['Concatenate', (None, 30, 128), 0],
                         ['Dense', (None, 30, 10), 1290, 'tanh'],
                         ['Dense', (None, 30, 1), 11, 'relu'],
                         ['Activation', (None, 30, 1), 0],
                         ['Dot', (None, 1, 64), 0],
                         ['InputLayer', [(None, 64)], 0],
                         ['LSTM',[(None, 64), (None, 64), (None, 64)], 33024,[(None, 1, 64), (None, 64), (None, 64)],'tanh'],
                         ['Dense', (None, 11), 715, 'softmax']]