Skip to content

srvCodes/continual_learning_with_vit

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

27 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Continual Learning with Vision Transformers

This repo hosts the official implementation of our CVPR 2022 workshop paper Towards Exemplar-Free Continual Learning in Vision Transformers: an Account of Attention, Functional and Weight Regularization.

TLDR; We introduce attentional and functional variants for asymmetric and symmetric Pooled Attention Distillation (PAD) losses in Vision Transformers:

Running the code

Given below are two examples for the asymmetric attentional and functional variants pooling along the height dimension on ImageNet-100.

  1. Attentional variant:
>>> python3 -u src/main_incremental.py --datasets imagenet_32_reduced --network Early_conv_vit --approach olwf_asym --nepochs $NEPOCHS --log disk --batch-size 1024 --gpu $GPU --exp-name dummy_attentional_exp --lr 0.01 --seed ${seed} --lamb 1.0 --num-tasks $NUM_TASKS --nc-first-task $NC_FIRST_TASK --lr-patience 20 --plast_mu 1.0 --pool-along 'height'   l
  1. Functional variant:
>>> python3 -u src/main_incremental.py --datasets imagenet_32_reduced --network Early_conv_vit --approach olwf_asympost --nepochs $NEPOCHS --log disk --batch-size 1024 --gpu $GPU --exp-name dummy_functional_exp --lr 0.01 --seed ${seed} --lamb 1.0 --num-tasks $NUM_TASKS --nc-first-task $NC_FIRST_TASK --lr-patience 20 --plast_mu 1.0 --pool-along 'height'   

The corresponding runs for symmetric variants would then be:

  1. Attentional variant:
>>> python3 -u src/main_incremental.py --datasets imagenet_32_reduced --network Early_conv_vit --approach olwf_asym --nepochs $NEPOCHS --log disk --batch-size 1024 --gpu $GPU --exp-name dummy_attentional_exp --lr 0.01 --seed ${seed} --lamb 1.0 --num-tasks $NUM_TASKS --nc-first-task $NC_FIRST_TASK --lr-patience 20 --plast_mu 1.0 --pool-along 'height' --sym 
  1. Functional variant:
>>> python3 -u src/main_incremental.py --datasets imagenet_32_reduced --network Early_conv_vit --approach olwf_asympost --nepochs $NEPOCHS --log disk --batch-size 1024 --gpu $GPU --exp-name dummy_functional_exp --lr 0.01 --seed ${seed} --lamb 1.0 --num-tasks $NUM_TASKS --nc-first-task $NC_FIRST_TASK --lr-patience 20 --plast_mu 1.0 --pool-along 'height' --sym 

Other available continual learning approaches with Vision Transformers include:

EWC • Finetuning • LwF • PathInt

The detailed scripts for our experiments can be found in scripts/.

Cite

If you found our implementation to be useful, feel free to use the citation:

@inproceedings{pelosin2022towards,
  title={Towards exemplar-free continual learning in vision transformers: an account of attention, functional and weight regularization},
  author={Pelosin, Francesco and Jha, Saurav and Torsello, Andrea and Raducanu, Bogdan and van de Weijer, Joost},
  booktitle={Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition},
  booksubtitle={Workshop on Continual Learning},
  pages={3820--3829},
  year={2022}
}

Acknowledgement

This repo is based on FACIL.

About

Code for our CVPR 2022 workshop paper "Towards Exemplar-Free Continual Learning in Vision Transformers"

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published