Using ConcatDataset

I’m using ConcatDataset class which is justified in pytorch document.
And when after the ConcatDataset ‘TypeError: object of type ‘ABCMeta’ has no len()’ is keep occuring.

Below is the code which I implemented. I am trying to concat two datasets and train.

def prepare_data(args, ckpt_dir=None, with_input_orig=False, split=None):

    train_sets = []

    train_preprocessor_kwargs = {}
    if 'cityscapes-with-depth' in args.dataset:
        Dataset = Cityscapes
        dataset_kwargs = {
            'n_classes': 19,
            'disparity_instead_of_depth': False
        valid_set = 'valid'

    if 'sunrgbd' in args.dataset:
        Dataset = SUNRGBD
        dataset_kwargs = {}
        valid_set = 'test'

    if len(train_sets) != len(args.dataset):
        raise Exception('Something went wrong. Please check your dataset names are valid')
    if len(train_sets) == 0:
        raise Exception('Dataset {} is not supported'.format(args.dataset))

    if len(args.dataset) != 1:
        Datasets = ConcatDataset(train_sets)

What is the problem?

The initialization of ConcatDataset requires that each input dataset has len(). Can you check if len() can be applied to each of element within train_sets?

You are passing class rather than instance to the list. You need to create Dataset instance from Cityscapes, SUNRGBD.