Closed YanjunLiu2 closed 1 month ago
Hey @YanjunLiu2
Can you verify that raw_nu
parameter of the kernel is also on cuda? BTW you could run kernel.to(device)
to move all of the kernel's parameters to a specified device, without having to worry about it yourself.
If the above does not help, could you please provide a minimal reproducible example for this? Thank you!
@YanjunLiu2 did you resolve the issue by any chance?
Closing due to inactivity, @YanjunLiu2 feel free to reopen.
Hello,
I tried to define a graph kernel named Gkernel to be used in gpytorch, and in the GP model I made a product of the Gkernel and a RBF kernel named Fkernel, which is for the other features. When I run the code on cpu it looks fine, but when I want to turn the calculations to gpu the error shows up. I think I moved everything to the gpu so it's a bit strange.
Gkernel mu cuda:0 train_x cuda:0 train_y cuda:0 Parameter likelihood.noise_covar.raw_noise is on device: cuda:0 Parameter mean_module.constant is on device: cuda:0 Parameter Gkernel.raw_outputscale is on device: cuda:0 Parameter Gkernel.base_kernel.raw_lengthscale is on device: cuda:0 Parameter Fkernel.raw_lengthscale is on device: cuda:0 sgid cuda:0 chem cuda:0 Traceback (most recent call last): File "/data/3DSC/scripts/with_SG_feature.py", line 78, in
model1, mll1 = make_and_fit_regressor_SG(train_x, train_y, Gkernel,
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/data/3DSC/meai/GP.py", line 294, in make_and_fit_regressorSG
, info_dict = fit_gpytorch_torch(model.Fkernel.lengthscale, mll, options={"
maxiter": 1000, "lr": lr})
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/data/3DSC/meai/GP.py", line 163, in fit_gpytorch_torch
output = mll.model(train_inputs)
^^^^^^^^^^^^^^^^^^^^^^^^
File "/data/yanjun_data/anaconda3/envs/meai/lib/python3.11/site-packages/gpyto
rch/models/exact_gp.py", line 257, in call
res = super().call(inputs, *kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/data/yanjun_data/anaconda3/envs/meai/lib/python3.11/site-packages/gpyto
rch/module.py", line 30, in call
outputs = self.forward(inputs, *kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/data/3DSC/meai/GP.py", line 280, in forward
covar_x = self.Gkernel(space_group_ids)self.Fkernel(chemical_features)