Back to DrivenData | Blog

Cuda Issue Submissions


I have made several submissions, and keep running into the same error.

RuntimeError: Expected object of device type cuda but got device type cpu for argument #1 ‘self’ in call to _thnn_conv2d_forward
ERROR conda.cli.main_run:execute(33): Subprocess for ‘conda run [‘python’, ‘’]’ command failed. (See above for error)

Here is the traceback in my scripts:

File “/codeexecution/”, line 127, in main
make_predictions(model, test_metadata, bands, predictions_dir)
File “/codeexecution/”, line 78, in make_predictions
preds = model.forward(x)

I am using a model from the segmentation models pytorch library rather than the pytorch lightning code example given in the competition. I have tried several different things to force the model to the cuda device but it doesn’t seem to work. I have tried model.cuda(),‘cuda’), and model = model.cuda(), but they all yield the same error.

Any recommendations for how I can get the submission to work? I tested the file in google colab and it worked fine.


Is it possible that the model is on GPU but the features x are on CPU? You could try x.cuda().

1 Like

That worked thank you very much!