Hello,
I would like to know if anyone knows the reason why my training and validation occurs quickly but then my testing (where I print out the f1 score and classification report ) takes over 5 hours and then times out on google colab.
Well in that case you are running on GPU, can you check that the batch size for test is not very small, also the operation you do to stack predictions is not “optimal”, because you keep copying small chunks of information from GPU to CPU, probably it’s better to keep all prediction on GPU, and at the end send everything to CPU.
make sure you call model.cuda() or model.to(device)so the model will run on GPU.
Instead of writing predlist=torch.cat([predlist,y_pred_targets.view(-1).cpu()]) you should keep all your tensors on GPU so just keep predlist=torch.cat([predlist,y_pred_targets.view(-1)]) and predlist=torch.zeros(0,dtype=torch.long, device=device) where device refers to your GPU. Then at the end you just make predlist=predlist.cpu() if your code require numpy arrays.
@cyRi-Le Hi,
Thank you.
I am trying this now and hopefully it doesn’t take too long.
It is perfectly fine for my other data loaders, it’s just one specific one that it seems to have an issue with.