Error saving and loading Seq2Seq model in Lesson 7 of the Code first into to NLP 2019 course and predicting on test data

This is in reference to the Code First Introduction to NLP 2019 lessons. I am working with the lesson 7 notebooks on translation and natural text generation. I was wondering if anyone has had some success saving a trained model and using that for inference. I am running into the ff errors/roadblocks and would like if someone can point me in the right direction.

  1. Error loading saved model on CPU - Error message “AttributeError: Can’t get attribute 'seq2seq_loss’”, seq2seq_loss is the loss function specified in the notebook i’m running. Note: I can load the saved model on a GPU successfully.
  2. Prediction error - After i use the add_test function to add new data to the learner, i am a little confused on how to proceed with the prediction. I used the pred_acts function from the notebook with dataset type set to Test but it returns this error “TypeError: object of type ‘int’ has no len()
1 Like

Hey @omolorun, I’m having the same issue, have you found any type of solution?