yjxiong / tsn-pytorch

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

test_model.py IndexError: list index out of range #101

Closed immaping closed 5 years ago

immaping commented 5 years ago

Hi anyone met this error? Anyone know how to solve this?

I have got the file of"ucf101_bninception__rgb_checkpoint.pth" successfully when i run main.py. Then i run test_model.py,but it not work and have some issues:

Traceback (most recent call last): File "/home/map/PycharmProjects/tsn-pytorch/test_models.py", line 128, in rst = eval_video((i, data, label)) File "/home/map/PycharmProjects/tsn-pytorch/test_models.py", line 116, in eval_video rst = net(input_var).data.cpu().numpy().copy() File "/home/map/PycharmProjects/tsn-pytorch/venv/lib/python3.6/site-packages/torch/nn/modules/module.py", line 357, in call result = self.forward(*input, *kwargs) File "/home/map/PycharmProjects/tsn-pytorch/venv/lib/python3.6/site-packages/torch/nn/parallel/data_parallel.py", line 69, in forward inputs, kwargs = self.scatter(inputs, kwargs, self.device_ids) File "/home/map/PycharmProjects/tsn-pytorch/venv/lib/python3.6/site-packages/torch/nn/parallel/data_parallel.py", line 80, in scatter return scatter_kwargs(inputs, kwargs, device_ids, dim=self.dim) File "/home/map/PycharmProjects/tsn-pytorch/venv/lib/python3.6/site-packages/torch/nn/parallel/scatter_gather.py", line 38, in scatter_kwargs inputs = scatter(inputs, target_gpus, dim) if inputs else [] File "/home/map/PycharmProjects/tsn-pytorch/venv/lib/python3.6/site-packages/torch/nn/parallel/scatter_gather.py", line 31, in scatter return scatter_map(inputs) File "/home/map/PycharmProjects/tsn-pytorch/venv/lib/python3.6/site-packages/torch/nn/parallel/scatter_gather.py", line 18, in scatter_map return list(zip(map(scatter_map, obj))) File "/home/map/PycharmProjects/tsn-pytorch/venv/lib/python3.6/site-packages/torch/nn/parallel/scatter_gather.py", line 15, in scatter_map return Scatter.apply(target_gpus, None, dim, obj) File "/home/map/PycharmProjects/tsn-pytorch/venv/lib/python3.6/site-packages/torch/nn/parallel/_functions.py", line 73, in forward streams = [_get_stream(device) for device in ctx.target_gpus] File "/home/map/PycharmProjects/tsn-pytorch/venv/lib/python3.6/site-packages/torch/nn/parallel/_functions.py", line 73, in streams = [_get_stream(device) for device in ctx.target_gpus] File "/home/map/PycharmProjects/tsn-pytorch/venv/lib/python3.6/site-packages/torch/nn/parallel/_functions.py", line 100, in _get_stream if _streams[device] is None: IndexError: list index out of range

Can anyone help me, thank you very much !

immaping commented 5 years ago

I have solved this question. Because i have only 1 gpu,i changed workers from "- j 4" to "- j 1",and this issue is removed.