NLP C3_W2: model.fit crashes

model.fit(train_dataset.batch(BATCH_SIZE),
          validation_data = val_dataset.batch(BATCH_SIZE),
          shuffle=True,
          epochs = 2)

crashes. restarting the kernel doesn’t help.

based on your error output, I would check at 3 places

  1. check if you have used a global variable instead of local variable as your dimension seems to be 104 in the label_vectorizer grade function codes
  2. Another most possible reason to check your code dimensionality mismatching would be to check input dim and output dim in the embedding layer for Grade function NER codes.
  3. Last but not the least masked accuracy grade function, how you computed masked accuracy as placing incorrect tuple can also lead to incorrect metric, leading to failed training.

Regards

DP

I don’t spot anything wrong with the code and global variables. Most of the cells are read-only for illustration purposes. ALL of the preceding unit tests pass!

click on my name and then message me screenshot of the grade function codes for masked accuracy.

Passing unittest test doesn’t confirm always your codes are correct, unittest are independent and relative to its respective grade function codes which may or may not pass based on the autograder or metadata.

hi @khteh

as I said your codes for

Compute masked accuracy (quotient between the total matches and the total valid values, i.e., the amount of non-masked values)

don’t require the axis argument, please remove it.

1 Like