I followed the instructions on chapter 12 of the book, training a LSTM that has a high accuracy.
But how do I actually test the model to see whether it can predict any input?
learn.get_preds
and learn.predict
didn’t seem to work.
1 Like
Hello @JumpyJason,
To test your LSTM model on new input, make sure your data is preprocessed the same way as during training. If learn.predict
doesn’t work, try wrapping your input in a DataLoader
and use:
dl = learn.dls.test_dl([your_input])
preds, _ = learn.get_preds(dl=dl)
This ensures compatibility with fastai’s inference pipeline. Also check that your model was exported with learn.export()
and reloaded with load_learner()
if you’re testing in a new session.
Best Regards,
Amy Cross
Great Information!