Error in Deep_Kernel_Learning_DenseNet_CIFAR_Tutorial.ipynb
See original GitHub issueIn the tutorial example for Deep Kernel Learning on the CIFAR datasets there is an issue in the test()
function. The following error is raised:
---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
<ipython-input-8-30679d80b21c> in <module>
3 with gpytorch.settings.use_toeplitz(False), gpytorch.settings.max_preconditioner_size(0):
4 train(epoch)
----> 5 test()
6 state_dict = model.state_dict()
7 likelihood_state_dict = likelihood.state_dict()
<ipython-input-7-91f72c08681a> in test()
35 with torch.no_grad():
36 output = likelihood(model(data))
---> 37 pred = output.argmax()
38 correct += pred.eq(target.view_as(pred)).cpu().sum()
39 test_loss /= len(test_loader.dataset)
AttributeError: 'Categorical' object has no attribute 'argmax'
It appears that the output of likelihood()
should be an instance of torch.Tensor
, and not torch.distributions.categorical.Categorical
. This is consistent with gpytorch.likelihoods.SoftmaxLikelihood
. Should .argmax()
be called on one of the attributes of output
, or is there another recommended best practice to return the predictions?
Issue Analytics
- State:
- Created 5 years ago
- Comments:7 (5 by maintainers)
Top Results From Across the Web
Error loading IPython notebook - Stack Overflow
When I try to open the file (FunIT\ experiment.ipynb): ipython notebook FunIT\ experiment.ipynb. I get the following error message. Error loading notebook.
Read more >File Load Error for getting_started.ipynb · Issue #11723 - GitHub
The path should be relative to the directory where JupyterLab was opened. For example if you are starting jupyter lab in /home/user you...
Read more >Cannot export python notebook to ipython notebook or html ...
I edited a python notebook in databricks and I'd like to export it as ipython notebook or html file. However, I got the...
Read more >Cannot upload "Linear Regression Practical Example (Part 2 ...
IPY", and when I click to upload it nothing happens. If I change the extension to ".ipynb" (as it should be), it appears...
Read more >Error: Creating Notebook Failed. An error occurred while ...
ipynb. Error Message. Various ArcGIS modules can be used with the Jupyter Notebook application installed with ArcGIS Pro, and a folder location ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@jacobrgardner I had been trying
pred = output.probs.argmax()
, but the dimension was wrong and would raise the followingRuntimeError
:@gpleiss Excellent, works like a charm now. (Fixed locally).
@messiest - just updated the example notebook. You might want to check out the new optimizer settings. In my latest experiments I’ve noticed that you want a much smaller learning rate on the kernel hyperparameters, but the GP’s variational parameters should have a pretty high learning rate.