yjxiong / tsn-pytorch

Temporal Segment Networks (TSN) in PyTorch
BSD 2-Clause "Simplified" License
1.07k stars 308 forks source link

RuntimeError: tensors are on different GPUs #72

Open wj320 opened 6 years ago

wj320 commented 6 years ago

File "main.py", line 306, in main() File "main.py", line 126, in main train(train_loader, model, criterion, optimizer, epoch) File "main.py", line 171, in train output = model(input_var) File "/home/work/.jumbo/lib/python2.7/site-packages/torch/nn/modules/module.py", line 206, in call result = self.forward(*input, kwargs) File "/home/work/.jumbo/lib/python2.7/site-packages/torch/nn/parallel/data_parallel.py", line 59, in forward return self.module(*inputs[0], *kwargs[0]) File "/home/work/.jumbo/lib/python2.7/site-packages/torch/nn/modules/module.py", line 206, in call result = self.forward(input, kwargs) File "/home/work/kr/libs/TSN/tsn-pytorch/models.py", line 197, in forward base_out = self.base_model(input.view((-1, sample_len) + input.size()[-2:])) File "/home/work/.jumbo/lib/python2.7/site-packages/torch/nn/modules/module.py", line 206, in call result = self.forward(*input, *kwargs) File "/home/work/kr/libs/TSN/tsn-pytorch/tf_model_zoo/bninception/pytorch_load.py", line 57, in forward data_dict[op[2]] = getattr(self, op[0])(data_dict[op[-1]]) File "/home/work/.jumbo/lib/python2.7/site-packages/torch/nn/modules/module.py", line 206, in call result = self.forward(input, **kwargs) File "/home/work/.jumbo/lib/python2.7/site-packages/torch/nn/modules/conv.py", line 237, in forward self.padding, self.dilation, self.groups) File "/home/work/.jumbo/lib/python2.7/site-packages/torch/nn/functional.py", line 40, in conv2d return f(input, weight, bias) RuntimeError: tensors are on different GPUs

yjxiong commented 5 years ago

Can you provide more context so others can better help you?

LucasTzz commented 5 years ago

I met the same problem when I tried to train TSN on only one GPU, ,maybe the network parameters and input data are loaded into different GPUs? But I have set the argument --gpus to 1 specific GPU. Can you help me with the problem, thank you very much!

770258506 commented 5 years ago

I met the same problem when I tried to train TSN on only one GPU,Can you solve it now?thank you very much!

LucasTzz commented 5 years ago

I met the same problem when I tried to train TSN on only one GPU,Can you solve it now?thank you very much!

Well, I tried lots of methods. To set parameter device_ids explicitly in every cuda function works for me, you can try it.