Пример #1
0
def get_data_tuple(splits: str, bs:int, shuffle=False, drop_last=False) -> DataTuple:
    dset = VQADataset(splits)
    tset = VQATorchDataset(dset)
    evaluator = VQAEvaluator(dset)
    data_loader = DataLoader(
        tset, batch_size=bs,
        shuffle=shuffle, num_workers=args.num_workers,
        drop_last=drop_last, pin_memory=True
    )

    return DataTuple(dataset=dset, loader=data_loader, evaluator=evaluator)
Пример #2
0
def get_data_tuple(splits: str,
                   bs: int,
                   shuffle=False,
                   drop_last=False,
                   dataset_type='vqa',
                   encoder_type='lxrt') -> DataTuple:
    dataset_class = datasets.get(dataset_type)
    if dataset_class is None:
        raise ValueError("unsupported dataset type {}".format(dataset_type))

    dset = dataset_class(splits, args.vocab_size)
    tset = VQATorchDataset(dset, encoder_type)
    evaluator = VQAEvaluator(dset)
    data_loader = DataLoader(tset,
                             batch_size=bs,
                             shuffle=shuffle,
                             num_workers=args.num_workers,
                             drop_last=drop_last,
                             pin_memory=True)

    return DataTuple(dataset=dset, loader=data_loader, evaluator=evaluator)