BayesWatch / deep-kernel-transfer

Official pytorch implementation of the paper "Bayesian Meta-Learning for the Few-Shot Setting via Deep Kernels" (NeurIPS 2020)
https://arxiv.org/abs/1910.05199
201 stars 29 forks source link

RuntimeError: You must train on the training inputs! #9

Closed surtantheta closed 2 years ago

surtantheta commented 2 years ago

We are trying to run the following command for regression: python train_regression.py --method="DKT" --seed=1 However, we face the following error:

Traceback (most recent call last): File "train_regression.py", line 37, in <module> model.train_loop(epoch, optimizer) File "/deep-kernel-transfer/methods/DKT_regression.py", line 53, in train_loop predictions = self.model(z) File "/home/.local/lib/python3.7/site-packages/gpytorch/models/exact_gp.py", line 256, in __call__ raise RuntimeError("You must train on the training inputs!") We use Conv3 as backbone Spectral kernel and we observe that in self.model(z) in line 53, DKT_regression.py, NaN values are generated for z. We are unable to find the reason for input values to get converted to NaN. However code runs fine with RBF kernel. Kindly help.

mpatacchiola commented 2 years ago

Hi @surtantheta

This kind of error is generally due to the fact that the train data set for the model (see this line) differ from the one used at prediction time (see this line). I suspect this is due to the fact that you are getting Nan value for the z vector.

If you are using a different set of data, be sure they are properly normalized. If you are using a different backbone you should initialize the weight in the proper way. Also check the version of Pytorch and GPytorch you are using. Be sure to use our same version (see the README).