Closed ChristianEschen closed 3 years ago
Hi @ChristianEschen that's a weird error which I haven't seen before. Can you print the output of the following lines -
for phase in ["train", "test"]:
iterator = datasets[phase].iterator()
count = 0
for _ in iterator:
count += 1
if count >= 10:
break
print(phase)
print(count)
Also, which exact version of Python are you using (like 3.6.2) and how did you install classy?
I get the same error as presented above. I use python 3.6.11. it is installed using pip install classy_vision.
Ah, I just noticed, your CUDA version is 11.0 - that isn't supported by Classy Vision yet. Can you try downgrading to CUDA 10.2 and running this?
cc @vreis , @jackhamburger since you guys had worked with CUDA 11.0, do you think this could be related?
Hi again,
I figured out that my ufc-101 dataset was not in the correct format. This means I had a "flatten" data structure.
So it was an error 40, indicating the error was 40 centimeters from the device... Thanks anyway.
Got it, I had figured that the dataset would throw an exception during initialization if there was a data error. Do you mind mentioning what the exact issue was and how you fixed it, for future users? :)
I got the same issue.
The test snippet does not work for me @mannatsingh
Traceback (most recent call last):
File "video_classification.py", line 120, in <module>
for _ in iterator:
File "/home/user/.pyenv/versions/env-wbGhSO8R-py3.7/lib/python3.7/site-packages/torch/utils/data/dataloader.py", line 352, in __iter__
return self._get_iterator()
File "/home/user/.pyenv/versions/env-wbGhSO8R-py3.7/lib/python3.7/site-packages/torch/utils/data/dataloader.py", line 294, in _get_iterator
return _MultiProcessingDataLoaderIter(self)
File "/home/user/.pyenv/versions/env-wbGhSO8R-py3.7/lib/python3.7/site-packages/torch/utils/data/dataloader.py", line 827, in __init__
self._reset(loader, first_iter=True)
File "/home/user/.pyenv/versions/env-wbGhSO8R-py3.7/lib/python3.7/site-packages/torch/utils/data/dataloader.py", line 857, in _reset
self._try_put_index()
File "/home/user/.pyenv/versions/env-wbGhSO8R-py3.7/lib/python3.7/site-packages/torch/utils/data/dataloader.py", line 1091, in _try_put_index
index = self._next_index()
File "/home/user/.pyenv/versions/env-wbGhSO8R-py3.7/lib/python3.7/site-packages/torch/utils/data/dataloader.py", line 427, in _next_index
return next(self._sampler_iter) # may raise StopIteration
File "/home/user/.pyenv/versions/env-wbGhSO8R-py3.7/lib/python3.7/site-packages/torch/utils/data/sampler.py", line 227, in __iter__
for idx in self.sampler:
File "/home/user/.pyenv/versions/env-wbGhSO8R-py3.7/lib/python3.7/site-packages/torchvision/datasets/samplers/clip_sampler.py", line 87, in __iter__
orig_indices = list(iter(self.dataset))
File "/home/user/.pyenv/versions/env-wbGhSO8R-py3.7/lib/python3.7/site-packages/classy_vision/dataset/classy_video_dataset.py", line 47, in __iter__
for clip in self.clip_sampler:
File "/home/user/.pyenv/versions/env-wbGhSO8R-py3.7/lib/python3.7/site-packages/torchvision/datasets/samplers/clip_sampler.py", line 167, in __iter__
idxs = torch.cat(idxs)
RuntimeError: There were no tensor arguments to this function (e.g., you passed an empty list of Tensors), but no fallback function is registered for schema aten::_cat. This usually means that this function requires a non-empty list of Tensors. Available functions are [CPU, CUDA, QuantizedCPU, BackendSelect, Named, AutogradOther, AutogradCPU, AutogradCUDA, AutogradXLA, AutogradPrivateUse1, AutogradPrivateUse2, AutogradPrivateUse3, Tracer, Autocast, Batched, VmapMode].
CPU: registered at /pytorch/build/aten/src/ATen/CPUType.cpp:2127 [kernel]
CUDA: registered at /pytorch/build/aten/src/ATen/CUDAType.cpp:2983 [kernel]
QuantizedCPU: registered at /pytorch/build/aten/src/ATen/QuantizedCPUType.cpp:297 [kernel]
BackendSelect: fallthrough registered at /pytorch/aten/src/ATen/core/BackendSelectFallbackKernel.cpp:3 [backend fallback]
Named: registered at /pytorch/aten/src/ATen/core/NamedRegistrations.cpp:7 [backend fallback]
AutogradOther: registered at /pytorch/torch/csrc/autograd/generated/VariableType_2.cpp:8078 [autograd kernel]
AutogradCPU: registered at /pytorch/torch/csrc/autograd/generated/VariableType_2.cpp:8078 [autograd kernel]
AutogradCUDA: registered at /pytorch/torch/csrc/autograd/generated/VariableType_2.cpp:8078 [autograd kernel]
AutogradXLA: registered at /pytorch/torch/csrc/autograd/generated/VariableType_2.cpp:8078 [autograd kernel]
AutogradPrivateUse1: registered at /pytorch/torch/csrc/autograd/generated/VariableType_2.cpp:8078 [autograd kernel]
AutogradPrivateUse2: registered at /pytorch/torch/csrc/autograd/generated/VariableType_2.cpp:8078 [autograd kernel]
AutogradPrivateUse3: registered at /pytorch/torch/csrc/autograd/generated/VariableType_2.cpp:8078 [autograd kernel]
Tracer: registered at /pytorch/torch/csrc/autograd/generated/TraceType_2.cpp:9654 [kernel]
Autocast: registered at /pytorch/aten/src/ATen/autocast_mode.cpp:258 [kernel]
Batched: registered at /pytorch/aten/src/ATen/BatchingRegistrations.cpp:511 [backend fallback]
VmapMode: fallthrough registered at /pytorch/aten/src/ATen/VmapModeRegistrations.cpp:33 [backend fallback]
I got a 24M ucf101_metadata.pt
and I assume my dataset format is correct?
>>> import torch
>>> a = torch.load('ucf101_metadata.pt')
>>> a.keys()
dict_keys(['video_paths', 'video_pts', 'video_fps'])
>>> len(a['video_paths'])
13320
>>> len(a['video_pts'])
13320
>>> len(a['video_fps'])
13320
>>>
BTW, I came from this issue, and have
for phase in ["train", "test"]:
task.set_dataset(datasets[phase], phase)
task.set_dataloader_mp_context('fork')
in the video classification tutorial following the suggestion in the mentioned issue. And setting the option to fork
, spawn
and forkserver
or setting num_workers
to 0
caused the same issue.
I encountered the same issue. The issue is probably related to torchvision
upstream and is fixed in this commit. If one set the data directory with a slash suffix like
# set it to the folder where video files are saved
video_dir = "/path/to/ucf101/"
The indice
will become []
before this commit and cause RuntimeError: There were no tensor arguments to this function
. It's a bit unfriendly torchvision
itself does not print any warning or raise errors.
Note that any unexpected dataset format may also cause the issue. Updating torchvision
fixed my issue.
Thanks so much @Yevgnen for the suggestion!
@liebkne I've verified that your metadata file looks correct - can you try @Yevgnen 's suggestion and see if that works for you?
Running step 5 in the the video classification toturial: import time import os
from classy_vision.trainer import LocalTrainer from classy_vision.hooks import CheckpointHook from classy_vision.hooks import LossLrMeterLoggingHook
hooks = [LossLrMeterLoggingHook(log_freq=4)]
checkpoint_dir = f"/tmp/classycheckpoint{time.time()}" os.mkdir(checkpoint_dir) hooks.append(CheckpointHook(checkpoint_dir, input_args={}))
task = task.set_hooks(hooks)
trainer = LocalTrainer()
gives me the following errror:
RuntimeError Traceback (most recent call last)