Skip to content

Consistent Prompting for Rehearsal-Free Continual Learning [CVPR2024]

Notifications You must be signed in to change notification settings

Zhanxin-Gao/CPrompt

Repository files navigation

Consistent Prompting for Rehearsal-Free Continual Learning (CVPR2024)

Official code for the our paper: Consistent Prompting for Rehearsal-Free Continual Learning (CPrompt).

Paper Link , Supplementary Material

The proposed consistent prompting

1.Dependent Packages and Platform

First we recommend to create a conda environment with all the required packages by using the following command.

conda env create -f environment.yml

This command creates a conda environment named CPrompt. You can activate the conda environment with the following command:

conda activate CPrompt

In the following sections, we assume that you use this conda environment or you manually install the required packages.

Note that you may need to adapt the environment.yml/requirements.txt files to your infrastructure. The configuration of these files was tested on Linux Platform with a GPU (RTX3080 Ti).

If you see the following error, you may need to install a PyTorch package compatible with your infrastructure.

RuntimeError: No HIP GPUs are available or ImportError: libtinfo.so.5: cannot open shared object file: No such file or directory

For example if your infrastructure only supports CUDA == 11.1, you may need to install the PyTorch package using CUDA11.1.

pip install torch==1.8.1+cu111 torchvision==0.9.1+cu111 torchaudio==0.8.1 -f https://download.pytorch.org/whl/torch_stable.html

2.Dataset

We have implemented the pre-processing of Split StanfordCars , Split ImageNet-R, Split CIFAR-100 and Split DomainNet. When training on Split CIFAR-100, this framework will automatically download it. When training on other datasets, you should specify the folder of your dataset in utils/data.py.

    def download_data(self):
        rootdir = "[DATA-PATH]"

3.Run

  • Split CIFAR-100

    python main.py --config=./exps/cifar100_vit.json
    
  • Split StanfordCars

    python main.py --config=./exps/stanfordcars.json
    
  • Split ImageNet-R

    python main.py --config=./exps/imagenetr.json
    
  • Split DomainNet

    python main.py --config=./exps/domainnet.json
    

4.Citation

If you find this code useful, please kindly cite the following paper:

@article{,
  title={Consistent Prompting for Rehearsal-Free Continual Learning},
  author={Zhanxin Gao, Jun CEN, Xiaobin Chang},
  booktitle = {Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition},
  year={2024}
}

5.Reference

This code is built on PyCIL.

About

Consistent Prompting for Rehearsal-Free Continual Learning [CVPR2024]

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages