Dataset not pickable error

Hi All,

I am encountering the following error:

NotImplementedError: Dataset is not picklable

This error showed up when i tried to build the getitem method as follows:
x, y = self.get_data(item)
sample = x.unsqueeze(0).to(device)
pred_target = test_model(sample).detach().cpu()
pred_target = pred_target.squeeze(0).squeeze(0)
corr_target = y - pred_target
print("item is : "+str(item))
return x, corr_target

The idea from this implementation is to get the difference from y and another quantity calculated using another NN put in evaluation mode. Please note that before adding the second component (where another NN is used) the training worked properly.
Thanks in advance