Loading a checkpoint to make predictions #1842
-
Hi there! I'm creating a Kaggle notebook on to use a previously saved checkpoint to make predictions.
But when I try to make the predictions, I get this error:
I'm creating the prediction dataset in the same way that is in my training notebook:
Where Do I need to explicitly send my input to the GPU? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 1 reply
-
To make It work, I needed to change my function from:
To:
My question is: Why during training I didn't need to use |
Beta Was this translation helpful? Give feedback.
-
When you load the checkpoint, you need to pass map_location="cpu" like
See for more info https://pytorch.org/docs/stable/generated/torch.load.html |
Beta Was this translation helpful? Give feedback.
When you load the checkpoint, you need to pass map_location="cpu" like
task = SemanticSegmentationTask.load_from_checkpoint(ckpt_path, map_location="cpu")
See for more info https://pytorch.org/docs/stable/generated/torch.load.html