Skip to content

Commit

Permalink
revert classes timeline values to sets
Browse files Browse the repository at this point in the history
  • Loading branch information
AntonioCarta committed Feb 14, 2024
1 parent d075a44 commit ec3f3c6
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 8 deletions.
11 changes: 4 additions & 7 deletions avalanche/benchmarks/scenarios/supervised.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
from avalanche.benchmarks.utils.classification_dataset import (
ClassificationDataset,
_as_taskaware_supervised_classification_dataset,
TaskAwareSupervisedClassificationDataset,
)
from avalanche.benchmarks.utils.data import AvalancheDataset
from avalanche.benchmarks.utils.data_attribute import DataAttribute
Expand Down Expand Up @@ -399,14 +398,12 @@ def _decorate_stream(obj: CLStream):
new_exp = copy(exp)
curr_cls = exp.dataset.targets.uniques

new_exp.classes_in_this_experience = list(curr_cls)
new_exp.previous_classes = list(set(prev_cls))
new_exp.classes_seen_so_far = list(curr_cls.union(prev_cls))
new_exp.classes_in_this_experience = curr_cls
new_exp.previous_classes = set(prev_cls)
new_exp.classes_seen_so_far = curr_cls.union(prev_cls)
# TODO: future_classes ignores repetitions right now...
# implement and test scenario with repetitions
new_exp.future_classes = list(
all_cls.difference(new_exp.classes_seen_so_far)
)
new_exp.future_classes = all_cls.difference(new_exp.classes_seen_so_far)
new_stream.append(new_exp)

prev_cls = prev_cls.union(curr_cls)
Expand Down
2 changes: 1 addition & 1 deletion avalanche/models/dynamic_modules.py
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@ def adaptation(self, experience: CLExperience):
self.active_units[: old_act_units.shape[0]] = old_act_units
# update with new active classes
if self.training:
self.active_units[curr_classes] = 1
self.active_units[list(curr_classes)] = 1

# update classifier weights
if old_nclasses == new_nclasses:
Expand Down

0 comments on commit ec3f3c6

Please sign in to comment.