Giter Club home page Giter Club logo

deep-kernel-transfer's People

Contributors

elliotjcrowley avatar jack-willturner avatar mpatacchiola avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

deep-kernel-transfer's Issues

Downloading Imagenet Data

It looks like one of the files needed to setup the ImageNet data as used in this repo has moved. When I run the download_miniImagenet.sh file I get:

--2022-01-11 10:15:16--  http://image-net.org/image/ILSVRC2015/ILSVRC2015_CLS-LOC.tar.gz
Resolving image-net.org (image-net.org)... 171.64.68.16
Connecting to image-net.org (image-net.org)|171.64.68.16|:80... connected.
HTTP request sent, awaiting response... 301 Moved Permanently

The website says links to Kaggle as a download source, but I'm not able to find the ILSVRC2015_CLS-LOC.tar.gz file available anywhere. Do you have an alternate location to download from by chance?

RuntimeError: You must train on the training inputs!

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.

whats the role of DKT? How Bayesian is being used in this paper (need under the hood explanation) and how bayesian and DKT are complimenting each other..

Hi,
The paper has not explained details of how DKT is creating the difference except in metrics which shows experiement results - Need how DKT is identified as the influencer/factor, what is the role/objective of DKT. Also in papaer, we see Baseline and Baseline++ models , what are these? Could you please give more details/explanations of these Baseline/Baseline++

Loaded DKT model performs poorly.

Hi there,

I was wondering why the saved and loaded model performs poorly compared to the original model. I used the exact same test data in both cases and got R2_score = 0.97, -0.001 for the original and loaded model respectively.

Best

DKT Regression

Your paper mentions about in-range and out-range mse in the regression use case. However, we don't find these errors separately in the codebase. On running test_regression.py we receive a single MSE. Can you kindly elaborate what this value represents (in-range or out-range) ?
Is the code and data available only for QMUL or sines also.

Sine DKT regression task met Matrix not positive definite issue gpytorch.utils.errors.NotPSDError

Hello I tried to run sine regression task DKT scripts as python train_DKT.py in sine folder and met the following issue. Environment
gpytorch 1.6.0
python 3.9
torch 1.10.1

/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/gpytorch/utils/cholesky.py:38: NumericalWarning: A not p.d., added jitter of 1.0e-06 to the diagonal
warnings.warn(
/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/gpytorch/utils/cholesky.py:38: NumericalWarning: A not p.d., added jitter of 1.0e-05 to the diagonal
warnings.warn(
/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/gpytorch/utils/cholesky.py:38: NumericalWarning: A not p.d., added jitter of 1.0e-04 to the diagonal
warnings.warn(
Traceback (most recent call last):
File "/Users/xichen.dxc/Desktop/project/gitlab/deep-kernel-transfer/sines/train_DKT.py", line 287, in
main()
File "/Users/xichen.dxc/Desktop/project/gitlab/deep-kernel-transfer/sines/train_DKT.py", line 183, in main
loss = -mll(predictions, gp.train_targets)
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/gpytorch/module.py", line 30, in call
outputs = self.forward(*inputs, **kwargs)
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/gpytorch/mlls/exact_marginal_log_likelihood.py", line 62, in forward
res = output.log_prob(target)
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/gpytorch/distributions/multivariate_normal.py", line 169, in log_prob
inv_quad, logdet = covar.inv_quad_logdet(inv_quad_rhs=diff.unsqueeze(-1), logdet=True)
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/gpytorch/lazy/lazy_tensor.py", line 1291, in inv_quad_logdet
cholesky = CholLazyTensor(TriangularLazyTensor(self.cholesky()))
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/gpytorch/lazy/lazy_tensor.py", line 1004, in cholesky
chol = self._cholesky(upper=False)
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/gpytorch/utils/memoize.py", line 59, in g
return _add_to_cache(self, cache_name, method(self, *args, **kwargs), *args, kwargs_pkl=kwargs_pkl)
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/gpytorch/lazy/lazy_tensor.py", line 435, in _cholesky
cholesky = psd_safe_cholesky(evaluated_mat, upper=upper).contiguous()
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/gpytorch/utils/cholesky.py", line 63, in psd_safe_cholesky
L = _psd_safe_cholesky(A, out=out, jitter=jitter, max_tries=max_tries)
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/gpytorch/utils/cholesky.py", line 45, in _psd_safe_cholesky
raise NotPSDError(f"Matrix not positive definite after repeatedly adding jitter up to {jitter_new:.1e}.")
gpytorch.utils.errors.NotPSDError: Matrix not positive definite after repeatedly adding jitter up to 1.0e-04.

Different Accuracies!

Hi @mpatacchiola
I'm using DKT code for classification on CUB [5 way- 1 shot]. I save two models during meta-training, best_model and last_model.
in test.py I add some code to test best_model and last_model.
I create two instantiates of DKT class:

elif params.method == 'DKT':
        # model           = DKT(model_dict[params.model], **few_shot_params)
        last_model      = DKT(model_dict[params.model], **few_shot_params)
        best_model      = DKT(model_dict[params.model], **few_shot_params)

and load saved files for each of them:

        best, last = True, True
        modelfile = None
        if params.save_iter != -1:
            modelfile   = get_assigned_file(checkpoint_dir,params.save_iter)
        if best:
            best_modelfile   = get_best_file(checkpoint_dir)
            print(f'\n best model {best_modelfile}')
        if last:
            files = os.listdir(checkpoint_dir)
            nums =  [int(f.split('.')[0]) for f in files if 'best' not in f]
            num = max(nums)
            print(f'\nModel at last epoch {num}')
            last_modelfile = os.path.join(checkpoint_dir, '{:d}.tar'.format(num))
            print(f'\nlast model {last_modelfile}\n')
       if best and best_modelfile is not None:
            best_model = best_model.cuda()
            tmp = torch.load(best_modelfile)
            best_model.load_state_dict(tmp['state'])

        if last and last_modelfile is not None:
            last_model = last_model.cuda()
            tmp = torch.load(last_modelfile)
            last_model.load_state_dict(tmp['state'])

when I run test.py for these models:

         if last:
            print('last')
            last_model.eval()
            acc_mean, acc_std = last_model.test_loop( novel_loader, return_std = True)
            print("-----------------------------")
            print('Test Acc last model = %4.2f%% +- %4.2f%%' %(acc_mean, acc_std))
            print("-----------------------------") 

        if best:
            print('Best') 
            best_model.eval()
            acc_mean, acc_std = best_model.test_loop( novel_loader, return_std = True)
            print("-----------------------------")
            print('Test Acc best model = %4.2f%% +- %4.2f%%' %(acc_mean, acc_std))
            print("-----------------------------") 

I have a problem with ACC.
If I run best_model or last model alone, I get some ACCs; If I run both of them (best, last= True, True) I get different ACC for the model that is run in the second step. (running last_model after best_model test, changes the ACC of last_model.)

gpytorch 1.6.0
torch 1.10.0

Could you please help me to figure out what the problem is?
I really appreciate any help you can provide.

Multi GPU Training

Can you provide the code or let me know how we can include Multi GPU for training this model? Due to ResNet + GP structure, I am unable to directly implement that.

Regression error

Hi,

After following the steps mentioned in the README file for regression, I am getting the following error using spectral kernel.

python train_regression.py --method="DKT" --seed=1
[0] - Loss: nan MSE: nan noise: nan
Traceback (most recent call last):
File "train_regression.py", line 37, in
model.train_loop(epoch, optimizer)
File "/deep-kernel-transfer/methods/DKT_regression.py", line 53, in train_loop
predictions = self.model(z)
File "/home/user/.local/lib/python3.7/site-packages/gpytorch/models/exact_gp.py", line 256, in call
raise RuntimeError("You must train on the training inputs!")
RuntimeError: You must train on the training inputs!

Can you please how to correct it and get the desired results?

Also, using rbf kernel I am getting Average MSE: 0.243 +- 0.18 with the default settings on QMUL data but the reported MSE is much lower. Is it in-range or out-range?

Thanks.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.