Assignement4- create the model

Hi everyone,

while the model is being created, running the history line, face this error. any advice would be appreciated. I also, provide the architecture.

# Get the untrained model
model = create_model(total_words, max_sequence_len)

# Train the model
history = model.fit(features, labels, epochs=50, verbose=1)```


Epoch 1/50

ValueError Traceback (most recent call last)
in ()
3
4 # Train the model
----> 5 history = model.fit(features, labels, epochs=50, verbose=1)

1 frames
/usr/local/lib/python3.7/dist-packages/tensorflow/python/framework/func_graph.py in autograph_handler(*args, **kwargs)
1145 except Exception as e: # pylint:disable=broad-except
1146 if hasattr(e, “ag_error_metadata”):
→ 1147 raise e.ag_error_metadata.to_exception(e)
1148 else:
1149 raise

ValueError: in user code:

File "/usr/local/lib/python3.7/dist-packages/keras/engine/training.py", line 1021, in train_function  *
    return step_function(self, iterator)
File "/usr/local/lib/python3.7/dist-packages/keras/engine/training.py", line 1010, in step_function  **
    outputs = model.distribute_strategy.run(run_step, args=(data,))
File "/usr/local/lib/python3.7/dist-packages/keras/engine/training.py", line 1000, in run_step  **
    outputs = model.train_step(data)
File "/usr/local/lib/python3.7/dist-packages/keras/engine/training.py", line 859, in train_step
    y_pred = self(x, training=True)
File "/usr/local/lib/python3.7/dist-packages/keras/utils/traceback_utils.py", line 67, in error_handler
    raise e.with_traceback(filtered_tb) from None
File "/usr/local/lib/python3.7/dist-packages/keras/engine/input_spec.py", line 264, in assert_input_compatibility
    raise ValueError(f'Input {input_index} of layer "{layer_name}" is '

**ValueError: Input 0 of layer "sequential_8" is incompatible with the layer: expected shape=(None, 11), found shape=(None, 10)```**

please find below the architecture

[code removed - moderator]

cheers,
Maryam.

max_sequence_len is the maximum length of a single row of training data.
Please see this line: features have shape: (15462, 10)
Use this hint to update your model definition.

Thanks for your time and reply.

I am not sure if I understand your mean completely. there is no line features have shape: (15462, 10) in the code. and max_sequence_len is a parameter defined by the notebook.

could you please clarify your mean again?

please find below the architecture of this model

[code removed - moderator]

I found the issue and solved it.