Obtaining experience datasets with correct transforms #995
-
Hi, I have been trying to create a specific dataclass using the avalanche benchmarks. I want to use the avalanche benchmarks to get obtain the list of pytorch datasets for all streams with correct split and transforms. benchmark_original = RotatedMNIST(n_experiences=5)
benchmark = benchmark_with_validation_stream(benchmark_original, validation_size=0.2, input_stream='train')
train_datasets = get_datasets_from_aval_stream(benchmark.train_stream)
valid_datasets = get_datasets_from_aval_stream(benchmark.valid_stream)
test_datasets = get_datasets_from_aval_stream(benchmark.test_stream)
def get_datasets_from_aval_stream(stream):
datasets = []
for i in range(len(stream)):
exp_dataset, exp_labels, exp_ids = stream[i].dataset[:]
exp_dataset = exp_dataset.squeeze(1)
datasets.append(torch.utils.data.TensorDataset(exp_dataset, exp_labels))
return datasets Now I have two questions,
Thanks for your help! |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 6 replies
-
Dear @prateeky2806 thanks for your question! :) For 1. you can take a look at the AvalancheDataset features, epsecially how we handle the transformations. For 2. no, we don't have a method that does that already, but in the basic case you can do just |
Beta Was this translation helpful? Give feedback.
Dear @prateeky2806 thanks for your question! :) For 1. you can take a look at the AvalancheDataset features, epsecially how we handle the transformations. For 2. no, we don't have a method that does that already, but in the basic case you can do just
datasets = [exp.dataset for exp in stream]
, you'll get a list of AvalancheDatasets, one for each experience.