CIR

Class-Incremental Learning with Repetition

Stars
6

Class-Incremental Learning with Repetition

This repository contains the official PyTorch implementation of "Class-Incremental Learning with Reptition", accepted to the Conference on Lifelong Learning Agents (CoLLAs - 2023).

Structure

The code structure is inspired by the Avalanche library.

├── cir                           # CIR as a package
    ├── benchmarks
        ├── ...                   # CIR generators
    ├── metrics
        ├── ...                   # metrics used for the experiments
    ├── models
        ├── ...                   # models used for the experiments
    ├── plugins
        ├── ...                   # Avalanche-based plugins
    ├── strategies
        ├── ...                   # strategies implemented and used in the experiments

├── experiments                   # contains scripts and notebooks used for running experiments
                                  # and visualization 
    ├── configs
        ├── ...                   # default hydra configs
    ├── notebooks
        ├── ...                   # notebooks used for visualization
    ├── scripts
        ├── ...                   # scripts for reproducing results in the paper
    train_cir.py                  # main trainer script for the CIR experiments

Running an experiment

This repository is based on the Avalanche library. You can first create a conda enviroment and install required packages using environment.yml:

  1. Install conda

  2. Clone the repo and create the conda environment:

git clone https://github.com/HamedHemati/CIR.git
conda env create -f environment.yml

Then, start an experiment using the scripts provided under experiments/scripts:

  1. Start training (example):
python -m experiments.train_cir --multirun \
  strategy=er_rs \
  dataset=cifar-100 \
  generator=slot_based \
  N=10 \
  K=10,30,50,80,100 \
  buffer_size=2000 \
  device="cuda:0" 

Generating CIR benchmarks

The notebooks visualize_cir-slot_single_stream and visualize_cir_sampling_single_stream under experiments/notebooks provide examples for how to generate CIR streams using both generators.