/hypercl

Continual Learning with Hypernetworks. A continual learning approach that has the flexibility to learn a dedicated set of parameters, fine-tuned for every task, that doesn't require an increase in the number of trainable weights and is robust against catastrophic forgetting.

Primary LanguagePythonApache License 2.0Apache-2.0

Continual Learning with Hypernetworks

A continual learning approach that has the flexibility to learn a dedicated set of parameters, fine-tuned for every task, that doesn't require an increase in the number of trainable weights and is robust against catastrophic forgetting.

For details on this approach please read our paper. You can find our spotlight presentation here and a more detailed introduction in this talk. Experiments on continual learning with hypernetworks using sequential data and recurrent networks can be found in this repository. Furthermore, this repository studies a probabilistic extension of the proposed CL algorithm.

If you are interested in working with hypernetworks in PyTorch, check out the package hypnettorch. The package also provides an example implementation of our method for task-incremental learning.

Toy Examples

Some toy regression problems can be explored in the folder toy_example. Please refer to the corresponding documentation. Example run:

$ python3 -m toy_example.train --no_cuda

MNIST Experiments

You can find instructions on how to reproduce our MNIST experiments and on how to use the corresponding code in the subfolder mnist.

CIFAR Experiments

Please checkout the subfolder cifar. You may use the script cifar.train_zenke to run experiments using the same network as Zenke et al. and the script cifar.train_resnet to run experiments with a Resnet-32.

Testing

All testing of implemented functionality is located in the subfolder tests and documented here. To run all unit tests, execute:

$ python3 -m unittest discover -s tests/ -t .

Documentation

Please refer to the README in the subfolder docs for instructions on how to compile and open the documentation.

Setup Python Environment

We use conda to manage Python environments. To create an environment that already fulfills all package requirements of this repository, simply execute

$ conda env create -f environment.yml
$ conda activate hypercl_env

Citation

Please cite our paper if you use this code in your research project.

@inproceedings{ohs2019hypercl,
title={Continual learning with hypernetworks},
author={Johannes von Oswald and Christian Henning and Benjamin F. Grewe and Jo{\~a}o Sacramento},
booktitle={International Conference on Learning Representations},
year={2020},
url={https://arxiv.org/abs/1906.00695}
}