question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Error running video classification toturial

See original GitHub issue

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/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:closed
  • Created 3 years ago
  • Comments:8 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
Yevgnencommented, Dec 7, 2020

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.

1reaction
ChristianEschencommented, Nov 5, 2020

I get the same error as presented above. I use python 3.6.11. it is installed using pip install classy_vision.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Video classification with Keras and Deep Learning
In this tutorial, you will learn how to perform video classification using Keras, Python, and Deep Learning.
Read more >
Video Classification | Video Classification Model In Python
In this article, we will build our very own video classification model in Python. This is a very hands-on tutorial so fire up...
Read more >
Introduction to Video Classification and Human Activity ...
In this post, we will learn about Video Classification. We will go over a number of approaches to make a video classifier for...
Read more >
Video classification with a 3D convolutional neural network
This tutorial demonstrates training a 3D convolutional neural network (CNN) for video classification using the UCF101 action recognition dataset.
Read more >
Video Classification with a CNN-RNN Architecture - Keras
Please make sure the missing libraries mentioned above are installed properly if you would like to use GPU. Follow the guide at https://www....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found