def post_adapt(self, agent, exp):
        """Save a copy of the model after each experience and
        update self.prev_classes to include the newly learned classes.

        :param agent: agent state
        :param exp: current experience
        """
        self.expcount += 1
        self.prev_model = copy.deepcopy(agent.model)
        task_ids = exp.dataset.targets_task_labels.uniques

        for task_id in task_ids:
            task_data = exp.dataset.task_set[task_id]
            pc = set(task_data.targets.uniques)

            if task_id not in self.prev_classes_by_task:
                self.prev_classes_by_task[task_id] = pc
            else:
                self.prev_classes_by_task[task_id] = self.prev_classes_by_task[
                    task_id
                ].union(pc)
Save a copy of the model after each experience and
        update self.prev_classes to include the newly learned classes.

        :param agent: agent state
        :param exp: current experience
        
avalanche/training/regularization.py