Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

problems when running GNP Classification Experiments #1

Open
git0405 opened this issue Jul 4, 2023 · 3 comments
Open

problems when running GNP Classification Experiments #1

git0405 opened this issue Jul 4, 2023 · 3 comments

Comments

@git0405
Copy link

git0405 commented Jul 4, 2023

Thanks for you help first.

  1. the first error i met it
    "plum.resolver.NotFoundLookupError: For function device, (device(type='cpu'),) could not be resolved."

Because i run on cpu, so I just replace the "with B.device(B.device(z)):" in "class SetConv1dEncoder(nn.Module):" of "encoder.py" with
"with B.device("cpu"):"

  1. Then error goes to "decoder.py".
Traceback (most recent call last):
  File "train_pac.py", line 420, in <module>
    tb_writer=writer, global_step=global_step)
  File "train_pac.py", line 46, in train
    loss_dict = model.loss(task['x_context'], task['y_context'])
  File "C:\Users\Desktop\experiments for test set bound\pac-bayes-tightness-small-data-master2\pac-bayes-tightness-small-data-master\pacbayes\classifiers.py", line 481, in loss
    post = self.architecture.infer(x, y)
  File "C:\Users\Desktop\experiments for test set bound\pac-bayes-tightness-small-data-master2\pac-bayes-tightness-small-data-master\pacbayes\architectures.py", line 52, in infer
    means, covs = self.inference_network(x, y)  # [B, D], [B, D, D]
  File "C:\Users\.conda\envs\py37\lib\site-packages\torch\nn\modules\module.py", line 1130, in _call_impl
    return forward_call(*input, **kwargs)
  File "C:\Users\Desktop\experiments for test set bound\pac-bayes-tightness-small-data-master2\pac-bayes-tightness-small-data-master\pacbayes\gnp\gnp.py", line 71, in forward
    xz, z = self.encoder_mean(x_context, y_context, x_target)
  File "C:\Users\.conda\envs\py37\lib\site-packages\torch\nn\modules\module.py", line 1130, in _call_impl
    return forward_call(*input, **kwargs)
  File "C:\Users\Desktop\experiments for test set bound\pac-bayes-tightness-small-data-master2\pac-bayes-tightness-small-data-master\pacbayes\gnp\encoder.py", line 34, in forward
    dists2 = B.pw_dists2(x_grid[None, :], xz)
  File "C:\Users\.conda\envs\py37\lib\site-packages\plum\function.py", line 392, in __call__
    return _convert(method(*args, **kw_args), return_type)
  File "C:\Users\.conda\envs\py37\lib\site-packages\lab\linear_algebra.py", line 502, in pw_dists2
    return norms_a + norms_b - 2 * B.matmul(a, b, tr_b=True)
  File "C:\Users\.conda\envs\py37\lib\site-packages\plum\function.py", line 392, in __call__
    return _convert(method(*args, **kw_args), return_type)
  File "C:\Users\.conda\envs\py37\lib\site-packages\lab\shape.py", line 185, in f_wrapped
    return f(*(unwrap_dimension(arg) for arg in args), **kw_args)
  File "C:\Users\.conda\envs\py37\lib\site-packages\lab\torch\linear_algebra.py", line 21, in matmul
    return torch.matmul(a, b)
RuntimeError: mat1 and mat2 shapes cannot be multiplied (480x1 and 128x1)

Any help will be greatly appreciated!!

@wesselb
Copy link
Member

wesselb commented Jul 4, 2023

Hey @git0405! It seems that there have been some API changes since the release of this repo that broke the code. I've pushed some updates that I believe fix the issue.

@git0405
Copy link
Author

git0405 commented Jul 4, 2023

Many thanks!!!

@wesselb
Copy link
Member

wesselb commented Jul 4, 2023

Not a problem at all. :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants