class_docstr: Base pytorch Module with support for task labels.
  
  Multi-task modules are ``torch.nn.Module`` for multi-task
  scenarios. The ``forward`` method accepts task labels, one for
  each sample in the mini-batch.
  
  By default the ``forward`` method splits the mini-batch by task
  and calls ``forward_single_task``. Subclasses must implement
  ``forward_single_task`` or override `forward. If ``task_labels == None``,
  the output is computed in parallel for each task.
class_docstr_tok: ["Base","pytorch","Module","with","support","for","task","labels",".","Multi-task","modules","are","``","torch.nn.Module","``","for","multi-task","scenarios",".","The","``","forward","``","method","accepts","task","labels",",","one","for","each","sample","in","the","mini-batch",".","By","default","the","``","forward","``","method","splits","the","mini-batch","by","task","and","calls","``","forward_single_task","``",".","Subclasses","must","implement","``","forward_single_task","``","or","override","`","forward",".","If","``","task_labels","==","None","``",",","the","output","is","computed","in","parallel","for","each","task","."]
docstr: Adapt the module (freeze units, add units...) using the current
  data. Optimizers must be updated after the model adaptation.
  
  Avalanche strategies call this method to adapt the architecture
  *before* processing each experience. Strategies also update the
  optimizer automatically.
  
  .. warning::
      As a general rule, you should NOT use this method to train the
      model. The dataset should be used only to check conditions which
      require the model's adaptation, such as the discovery of new
      classes or tasks.
  
  :param experience: the current experience.
  :return:
docstr_tok: ["Adapt","the","module","(","freeze","units",",","add","units","...",")","using","the","current","data",".","Optimizers","must","be","updated","after","the","model","adaptation",".","Avalanche","strategies","call","this","method","to","adapt","the","architecture","*","before","*","processing","each","experience",".","Strategies","also","update","the","optimizer","automatically",".","..","warning",":",":","As","a","general","rule",",","you","should","NOT","use","this","method","to","train","the","model",".","The","dataset","should","be","used","only","to","check","conditions","which","require","the","model","'s","adaptation",",","such","as","the","discovery","of","new","classes","or","tasks",".",":","param","experience",":","the","current","experience",".",":","return",":"]
code: def adaptation(self, experience: CLExperience):
      """Adapt the module (freeze units, add units...) using the current
      data. Optimizers must be updated after the model adaptation.
  
      Avalanche strategies call this method to adapt the architecture
      *before* processing each experience. Strategies also update the
      optimizer automatically.
  
      .. warning::
          As a general rule, you should NOT use this method to train the
          model. The dataset should be used only to check conditions which
          require the model's adaptation, such as the discovery of new
          classes or tasks.
  
      :param experience: the current experience.
      :return:
      """
      curr_classes = experience.classes_in_this_experience
      self.max_class_label = max(
          self.max_class_label, max(curr_classes) + 1
      )
      if self.training:
          self.train_adaptation(experience)
      else:
          self.eval_adaptation(experience)
  
imports: import torch
  from torch.nn import Module
  from typing import Optional
  from avalanche.benchmarks.utils.flat_data import ConstantSequence
  from avalanche.benchmarks.scenarios import CLExperience
label_desc: Use image node_id 2 for calling the MultiTaskModule obj's underlying member method code with example usage: obj.adaptation(experience) without return types