Error running video classification toturial
See original GitHub issueRunning 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/classy_checkpoint_{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) <ipython-input-9-bdf37dce7f15> in <module>() 15 16 trainer = LocalTrainer() —> 17 trainer.train(task)
/home/gandalf/anaconda3/envs/py36/lib/python3.6/site-packages/classy_vision/trainer/local_trainer.py in train(self, task) 25 set_cpu_device() 26 —> 27 super().train(task)
/home/gandalf/anaconda3/envs/py36/lib/python3.6/site-packages/classy_vision/trainer/classy_trainer.py in train(self, task) 43 task.on_start() 44 while not task.done_training(): —> 45 task.on_phase_start() 46 while True: 47 try:
/home/gandalf/anaconda3/envs/py36/lib/python3.6/site-packages/classy_vision/tasks/classification_task.py in on_phase_start(self) 943 self.phase_start_time_total = time.perf_counter() 944 –> 945 self.advance_phase() 946 947 for hook in self.hooks:
/home/gandalf/anaconda3/envs/py36/lib/python3.6/site-packages/classy_vision/tasks/classification_task.py in advance_phase(self) 845 # Re-build dataloader & re-create iterator anytime membership changes. 846 self._recreate_data_loader_from_dataset() –> 847 self.create_data_iterator() 848 # Set up pytorch module in train vs eval mode, update optimizer. 849 self._set_model_train_mode()
/home/gandalf/anaconda3/envs/py36/lib/python3.6/site-packages/classy_vision/tasks/classification_task.py in create_data_iterator(self) 898 # are cleaned up. 899 del self.data_iterator –> 900 self.data_iterator = iter(self.dataloaders[self.phase_type]) 901 902 def _set_model_train_mode(self):
/home/gandalf/anaconda3/envs/py36/lib/python3.6/site-packages/torch/utils/data/dataloader.py in iter(self) 350 return self._iterator 351 else: –> 352 return self._get_iterator() 353 354 @property
/home/gandalf/anaconda3/envs/py36/lib/python3.6/site-packages/torch/utils/data/dataloader.py in _get_iterator(self) 292 return _SingleProcessDataLoaderIter(self) 293 else: –> 294 return _MultiProcessingDataLoaderIter(self) 295 296 @property
/home/gandalf/anaconda3/envs/py36/lib/python3.6/site-packages/torch/utils/data/dataloader.py in init(self, loader) 825 _utils.signal_handling._set_SIGCHLD_handler() 826 self._worker_pids_set = True –> 827 self._reset(loader, first_iter=True) 828 829 def _reset(self, loader, first_iter=False):
/home/gandalf/anaconda3/envs/py36/lib/python3.6/site-packages/torch/utils/data/dataloader.py in _reset(self, loader, first_iter) 855 # prime the prefetch loop 856 for _ in range(self._prefetch_factor * self._num_workers): –> 857 self._try_put_index() 858 859 def _try_get_data(self, timeout=_utils.MP_STATUS_CHECK_INTERVAL):
/home/gandalf/anaconda3/envs/py36/lib/python3.6/site-packages/torch/utils/data/dataloader.py in _try_put_index(self) 1089 1090 try: -> 1091 index = self._next_index() 1092 except StopIteration: 1093 return
/home/gandalf/anaconda3/envs/py36/lib/python3.6/site-packages/torch/utils/data/dataloader.py in _next_index(self) 425 426 def _next_index(self): –> 427 return next(self._sampler_iter) # may raise StopIteration 428 429 def _next_data(self):
/home/gandalf/anaconda3/envs/py36/lib/python3.6/site-packages/torch/utils/data/sampler.py in iter(self) 225 def iter(self): 226 batch = [] –> 227 for idx in self.sampler: 228 batch.append(idx) 229 if len(batch) == self.batch_size:
/home/gandalf/anaconda3/envs/py36/lib/python3.6/site-packages/torchvision/datasets/samplers/clip_sampler.py in iter(self) 94 95 if isinstance(self.dataset, Sampler): —> 96 orig_indices = list(iter(self.dataset)) 97 indices = [orig_indices[i] for i in indices] 98
/home/gandalf/anaconda3/envs/py36/lib/python3.6/site-packages/classy_vision/dataset/classy_video_dataset.py in iter(self) 45 num_samples = len(self) 46 n = 0 —> 47 for clip in self.clip_sampler: 48 if n < num_samples: 49 yield clip
/home/gandalf/anaconda3/envs/py36/lib/python3.6/site-packages/torchvision/datasets/samplers/clip_sampler.py in iter(self) 173 s += length 174 idxs.append(sampled) –> 175 idxs_ = torch.cat(idxs) 176 # shuffle all clips randomly 177 perm = torch.randperm(len(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]
My setup is the following:
- PyTorch Version (e.g., 1.0): 1.7.0
- OS (e.g., Linux): Ubuntu 18,04
- How you installed PyTorch (
conda
,pip
, source): conda - Build command you used (if compiling from source):
- Python version: 3.6.11
- CUDA/cuDNN version: 11.0
- GPU models and configuration: 1x RTX 2080 TI
- Any other relevant information: Classy_vision is installed using pip
Issue Analytics
- State:
- Created 3 years ago
- Comments:8 (4 by maintainers)
Top GitHub Comments
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 likeThe
indice
will become[]
before this commit and causeRuntimeError: There were no tensor arguments to this function
. It’s a bit unfriendlytorchvision
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.I get the same error as presented above. I use python 3.6.11. it is installed using pip install classy_vision.