View in #questions-forum on Slack

@Deep_Gravity:Dear all, I am quite new in using Avalanche and also CL. I am using Avalanche for a class incremental learning, but struggling to figure out how can I prepare the dataset, and using Avalanche. My experiment only has two tasks. In the first task, I have 10 classes, and in the second task I have only 1 class. The number of samples per-class are different, and task 2 only has small number of samples.Of course, I would like to use customized model, and Avalanche’s CL strategies. But, as the first step, I am trying to use only SimpleMLP, and Naive CL strategy in order to understand how Avalanche work.

So my questions are:

1- To which number I need to set the`num_classes`

argument of`SimpleMLP`

?2- How the

`Naive`

algorithm train the model? Does it train the neurons which are related to the task 2, while running on task 1?I have more questions, but I will ask later.

many thanks for your help in advance.

@andcos:Hi @Deep_Gravity! Given that your MLP operates in single head (only one output layer shared across all tasks), you can set`num_classes`

to be the total number of classes in your entire dataset (11 in your case). The`Naive`

algorithm trains the model on all the 10 classes and then finetunes it on the last class, without adding any specific CL strategy. The output neuron related to task 2 is trained also during task 1 since the loss is not masked by default. For your dataset, you can simply create it as a pytorch dataset (e.g.`TensorDataset`

) and then apply the`nc_benchmark`

and choose which class goes in which experience (what you call task here).

You can post on our avalanche Github discussion page so that we can help you properly

@Deep_Gravity:Hi @andcos Many thanks for your reply. I will ask my other question on github. I though that maybe here we need to ask this kind of questions. So, I will check my code with your advice to see if I can fix the error or not. thanks again.

Hi @andcos I still get the same error:`Starting experiment... Start of experience: 0 Current Classes: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10] -- >> Start of training phase << -- -- Starting training on experience 0 (Task 0) from train stream -- 100%|████████████████████████████████████████████████████████████████████████████████| 240/240 [16:23<00:00, 4.10s/it] Epoch 0 ended. Loss_Epoch/train_phase/train_stream/Task000 = 2.5065 Top1_Acc_Epoch/train_phase/train_stream/Task000 = 0.0974 -- >> End of training phase << -- Training completed Start of experience: 1 Current Classes: [11] -- >> Start of training phase << -- -- Starting training on experience 1 (Task 1) from train stream -- 0it [00:00, ?it/s]Traceback (most recent call last):`

For task 0 (includes the first 10 classes) it works, but when starts task 1 (only include the 11th class), it gives the following error:

`IndexError: Target 11 is out of bounds.`

@andcos:make sure your targets start from 0. If you have 11 in your targets you are dealing with 12 classes (0-11), not 11.

@Deep_Gravity:@andcos Thanks, yes, now it works. So I indeed increased the number of classes of the 1st task to 11. so in total i have now 12 classes.

I am using`paths_benchmark`

for making my train and test experiences. But not sure if I am doing right or not. I prepared the following figure to show how I used this method.Did I understand

`path_benchmak`

correctly?