Problem with provided model/batch configuration

In Course 3 week 2, I’m getting some sort of error in the provided code and the pre-trained model. My data_generator and GRULM functions passed all tests and look right as far as I can tell… The symptom is “dimension mismatch”.

UNQ_C6 (UNIQUE CELL IDENTIFIER, DO NOT EDIT)

Testing

model = GRULM()
model.init_from_file(‘model.pkl.gz’)
batch = next(data_generator(batch_size, max_length, lines, shuffle=False))
preds = model(batch[0]) <-------

TypeError: dot_general requires contracting dimensions to have the same shape, got [512] and [1024].

Any pointer?

Hi @Christine

This looks like data_generator passed wrong length. I would check your data_generator function if you use max_length argument correctly (especially when padding). If you are still unable to find a solution, please private message me your Assignment notebook and I will look into it.

Cheers

Hi I am having similar error while evaluation

UNQ_C6 (UNIQUE CELL IDENTIFIER, DO NOT EDIT)

Testing

model = GRULM()
model.init_from_file(‘model.pkl.gz’)
batch = next(data_generator(batch_size, max_length, lines, shuffle=False))
preds = model(batch[0]) <==error part
log_ppx = test_model(preds, batch[1])
print(‘The log perplexity and perplexity of your model are respectively’, log_ppx, np.exp(log_ppx))

TypeError: dot_general requires contracting dimensions to have the same shape, got [512] and [1024].

Please find my lab ID: wbdidesyhvpy