continuum icon indicating copy to clipboard operation
continuum copied to clipboard

copy.deepcopy(train_scenario) fails for Permuted MNIST

Open Hacky-bot opened this issue 3 years ago • 1 comments

Hi,

I'm trying to use continuum for permuted and rotated MNIST datasets. I have to create a copy of train_scenario to create buffer at the end of every task. I tried the following to take a deepcopy of scenario and fill it with samples in buffer.

scenario = Permutations(
            cl_dataset=MNIST(path, train=is_train, download=True),
            nb_tasks=args.number_of_tasks,
            seed=args.seed,
            base_transformations=transforms,
            shared_label_space=True
        )

train_dataset = scenario[0] buffer = copy.deepcopy(train_dataset) buffer._x = new samples buffer._y = new labels

I'm getting the error TypeError: cannot pickle 'torch._C.Generator' object when I try to take a deepcopy of the train_dataset in P-MNIST, however, the same code snippet works fine in Rotated-MNIST. Any help would be much helpful!

Hacky-bot avatar Jun 16 '22 14:06 Hacky-bot

Hi @Hacky-bot , thanks for your issue. We will look at your error. Maybe a valid way to create your buffer without getting an error (I can not test it right now), could be:

buffer = train_dataset.get_random_samples(len(train_dataset))

Tell me if it is working for you :)

TLESORT avatar Jun 16 '22 14:06 TLESORT

Closed for inactivity.

TLESORT avatar Dec 06 '22 22:12 TLESORT