예제 #1
0
 def __init__(self, num_data, batch_size):
     self.batch_size = batch_size
     config = OmegaConf.create({
         "use_features": True,
         "annotations": {
             "train": "not_a_real_annotations_dataset",
             "val": "not_a_real_annotations_dataset",
         },
         "features": {
             "train": "not_a_real_features_dataset",
             "val": "not_a_real_features_dataset",
         },
         "dataset_config": {
             "simple": 0
         },
     })
     self._num_data = num_data
     self._batch_size = batch_size
     self.config = config
     self.dataset_list = []
     dataset_builder = MMFDatasetBuilder(
         "simple", functools.partial(NumbersDataset, num_examples=num_data))
     dataset_builder.train_dataloader = self._get_dataloader
     dataset_builder.val_dataloader = self._get_dataloader
     dataset_builder.test_dataloader = self._get_dataloader
     self.datamodules = {"simple": dataset_builder}
예제 #2
0
 def __init__(self, config, num_data):
     super().__init__(config)
     batch_size = config.training.batch_size
     config = OmegaConf.create(
         {
             "use_features": True,
             "annotations": {
                 "train": "not_a_real_annotations_dataset",
                 "val": "not_a_real_annotations_dataset",
             },
             "features": {
                 "train": "not_a_real_features_dataset",
                 "val": "not_a_real_features_dataset",
             },
             "dataset_config": {"numbers": 0},
         }
     )
     self._num_data = num_data
     self.batch_size = batch_size
     self.config = config
     self.dataset_list = []
     dataset_builder = MMFDatasetBuilder(
         "numbers",
         functools.partial(NumbersDataset, num_examples=num_data, always_one=True),
     )
     dataset_builder.train_dataloader = self._get_dataloader_train
     dataset_builder.val_dataloader = self._get_dataloader_val
     dataset_builder.test_dataloader = self._get_dataloader_test
     self.datamodules = {"numbers": dataset_builder}
 def _create_dataset(self, dataset_type):
     dataset_builder = MMFDatasetBuilder(
         "vqa", functools.partial(SimpleMMFDataset, num_examples=100))
     return dataset_builder.load(self.config, dataset_type)