ContinualAI / avalanche

Avalanche: an End-to-End Library for Continual Learning based on PyTorch.
http://avalanche.continualai.org
MIT License
1.79k stars 292 forks source link

Unclear why different experiences in a stream have the same task_label #1650

Closed blmussati closed 5 months ago

blmussati commented 6 months ago
# Creating the benchmark (scenario object)
    split_mnist = SplitMNIST(
        n_experiences=5,
        seed=3,
    )

  # Train and test streams
  train_stream = split_mnist.train_stream
  test_stream = split_mnist.test_stream

  # Iterate over the train stream
  for experience in train_stream:
      print(f"Start of task {experience.task_label}")
      print(f"Classes in this task: {experience.classes_in_this_experience}")

      # Retrieve the current PyTorch training set through the experience
      current_training_set = experience.dataset
      print(f"This task contains {len(current_training_set)} training examples")

      # Recover the corresponding test experience in the test stream
      print(f"Current experience {experience.current_experience}")
      current_test_set = test_stream[experience.current_experience].dataset
      print(f"This task contains {len(current_test_set)} test examples")

For every experience, the first print statement prints Start of task 0 But the current experience print statement correctly updates experience.current_experience from 0 all the way to 4.

It is unclear to me what an experience is because of this behaviour and because of what is written on the Avalanche website:

Experiences are batch of data (or "tasks") that can be provided with or without a specific task label.

AntonioCarta commented 5 months ago

Task labels are kept constant for task-agnostic scenarios.