Continuum Learning with GEM: Gradient Episodic Memory

Overview

Gradient Episodic Memory for Continual Learning

Source code for the paper:

@inproceedings{GradientEpisodicMemory,
    title={Gradient Episodic Memory for Continual Learning},
    author={Lopez-Paz, David and Ranzato, Marc'Aurelio},
    booktitle={NIPS},
    year={2017}
}

To replicate the experiments, execute ./run_experiments.sh.

This source code is released under a Attribution-NonCommercial 4.0 International license, find out more about it here.

Comments
  • ValueError: matrix G is not positive definite

    ValueError: matrix G is not positive definite

    Hey team

    Thank you so much for releasing the code for your paper. It is very useful. I have facing one problem with the code.

    I am training my code using a series of tasks. The code works fine for initial tasks but once in a while it would crash with the following error:

    v = quadprog.solve_qp(P, q, G, h)[0]
    File "quadprog/quadprog.pyx", line 104, in quadprog.solve_qp
    ValueError: matrix G is not positive definite
    

    I could think of one reason why this could happen - Lets say that the gradient corresponding to the current task is in a direction completely opposite to that of the gradient corresponding to the ith previous task. In this case, when we take the projection, of the current gradient with respect to the episodic gradient, the projection turns out to be a non positive-definite matrix (in the extreme case, the projection turns out to be exactly a zero vector).

    Do you know of any other reasons why this might happen or if I could get around this problem by tweaking some hyperparams.

    opened by shagunsodhani 6
  • Memory Error while running the code

    Memory Error while running the code

    Can you please let me know the system specs on which the model was trained. I am trying to run gem.py on GPU RTX 2080 but I am receiving the memory error. Thank you.

    opened by vidit98 1
  • Incremental Learning

    Incremental Learning

    Can incremental learning be achieved, that is to say, if a model can recognize images as cats and dogs, it is necessary to add new categories on this basis without retraining all data?

    opened by LIMr1209 1
  • ValueError: matrix G is not positive definite

    ValueError: matrix G is not positive definite

    Thanks for your great work and for releasing these code.

    I am having the same problem. As suggested I have done the following:

    G = np.eye(t) + np.eye(t)*0.00001

    But still, I am having the same error: v = quadprog.solve_qp(P, q, G, h)[0] File "quadprog/quadprog.pyx", line 104, in quadprog.solve_qp ValueError: matrix G is not positive definite

    Any suggestion?

    opened by andreamad8 1
  • Unable to run the code

    Unable to run the code

    Hi,

    While trying to replicate the ICARL code, the following line throws an issue. https://github.com/facebookresearch/GradientEpisodicMemory/blob/master/model/icarl.py#L141

    The dictionary self.mem_class_x is a dictionary with keys being tensors while it is accessed through integers. This leads to a keyerror issue.

    Can you suggest something?

    opened by gravity1989 1
  • Small fix in  results/plot_results.py

    Small fix in results/plot_results.py

    The script "plot_results.py" was not working, so I changed : acc, bwt, fwt = data[3][5:] into acc, bwt, fwt = data[3][:]

    (I also added a gitignore and an option to not download the data each time the script is run :) )

    opened by TLESORT 1
  • Question about EWC Implementation

    Question about EWC Implementation

    Hello developers! I looked at the implementation of EWC and got confused about computing the diagonal of the empirical Fisher Information Matrix. In https://github.com/facebookresearch/GradientEpisodicMemory/blob/34c6b8e9a0607db7567301c48b727430d20bee7e/model/ewc.py#L88 the square of the sum of gradients of all data points in the memory are computed, but this is not equal to the sum of squares of gradients. The latter should be used to compute Empirical Fisher, see https://wiseodd.github.io/techblog/2018/03/11/fisher-information/. Could you confirm this?

    opened by yunboouyang 0
Owner
Facebook Research
Facebook Research
The Dual Memory is build from a simple CNN for the deep memory and Linear Regression fro the fast Memory

Simple-DMA a simple Dual Memory Architecture for classifications. based on the paper Dual-Memory Deep Learning Architectures for Lifelong Learning of

null 1 Jan 27, 2022
[CVPR'21] FedDG: Federated Domain Generalization on Medical Image Segmentation via Episodic Learning in Continuous Frequency Space

FedDG: Federated Domain Generalization on Medical Image Segmentation via Episodic Learning in Continuous Frequency Space by Quande Liu, Cheng Chen, Ji

Quande Liu 178 Jan 6, 2023
Alex Pashevich 62 Dec 24, 2022
A PyTorch implementation of Learning to learn by gradient descent by gradient descent

Intro PyTorch implementation of Learning to learn by gradient descent by gradient descent. Run python main.py TODO Initial implementation Toy data LST

Ilya Kostrikov 300 Dec 11, 2022
PyTorch Code of "Memory In Memory: A Predictive Neural Network for Learning Higher-Order Non-Stationarity from Spatiotemporal Dynamics"

Memory In Memory Networks It is based on the paper Memory In Memory: A Predictive Neural Network for Learning Higher-Order Non-Stationarity from Spati

Yang Li 12 May 30, 2022
Segcache: a memory-efficient and scalable in-memory key-value cache for small objects

Segcache: a memory-efficient and scalable in-memory key-value cache for small objects This repo contains the code of Segcache described in the followi

TheSys Group @ CMU CS 78 Jan 7, 2023
Implementation of a memory efficient multi-head attention as proposed in the paper, "Self-attention Does Not Need O(n²) Memory"

Memory Efficient Attention Pytorch Implementation of a memory efficient multi-head attention as proposed in the paper, Self-attention Does Not Need O(

Phil Wang 180 Jan 5, 2023
A fast, scalable, high performance Gradient Boosting on Decision Trees library, used for ranking, classification, regression and other machine learning tasks for Python, R, Java, C++. Supports computation on CPU and GPU.

Website | Documentation | Tutorials | Installation | Release Notes CatBoost is a machine learning method based on gradient boosting over decision tree

CatBoost 6.9k Jan 4, 2023
A fast, distributed, high performance gradient boosting (GBT, GBDT, GBRT, GBM or MART) framework based on decision tree algorithms, used for ranking, classification and many other machine learning tasks.

Light Gradient Boosting Machine LightGBM is a gradient boosting framework that uses tree based learning algorithms. It is designed to be distributed a

Microsoft 14.5k Jan 8, 2023
A fast, scalable, high performance Gradient Boosting on Decision Trees library, used for ranking, classification, regression and other machine learning tasks for Python, R, Java, C++. Supports computation on CPU and GPU.

Website | Documentation | Tutorials | Installation | Release Notes CatBoost is a machine learning method based on gradient boosting over decision tree

CatBoost 5.7k Feb 12, 2021
Storchastic is a PyTorch library for stochastic gradient estimation in Deep Learning

Storchastic is a PyTorch library for stochastic gradient estimation in Deep Learning

Emile van Krieken 140 Dec 30, 2022
Official implementation of "GS-WGAN: A Gradient-Sanitized Approach for Learning Differentially Private Generators" (NeurIPS 2020)

GS-WGAN This repository contains the implementation for GS-WGAN: A Gradient-Sanitized Approach for Learning Differentially Private Generators (NeurIPS

null 46 Nov 9, 2022
This project provides a stock market environment using OpenGym with Deep Q-learning and Policy Gradient.

Stock Trading Market OpenAI Gym Environment with Deep Reinforcement Learning using Keras Overview This project provides a general environment for stoc

Kim, Ki Hyun 769 Dec 25, 2022
PGPortfolio: Policy Gradient Portfolio, the source code of "A Deep Reinforcement Learning Framework for the Financial Portfolio Management Problem"(https://arxiv.org/pdf/1706.10059.pdf).

This is the original implementation of our paper, A Deep Reinforcement Learning Framework for the Financial Portfolio Management Problem (arXiv:1706.1

Zhengyao Jiang 1.5k Dec 29, 2022
On the model-based stochastic value gradient for continuous reinforcement learning

On the model-based stochastic value gradient for continuous reinforcement learning This repository is by Brandon Amos, Samuel Stanton, Denis Yarats, a

Facebook Research 46 Dec 15, 2022
Implementation of Learning Gradient Fields for Molecular Conformation Generation (ICML 2021).

[PDF] | [Slides] The official implementation of Learning Gradient Fields for Molecular Conformation Generation (ICML 2021 Long talk) Installation Inst

MilaGraph 117 Dec 9, 2022
Learning recognition/segmentation models without end-to-end training. 40%-60% less GPU memory footprint. Same training time. Better performance.

InfoPro-Pytorch The Information Propagation algorithm for training deep networks with local supervision. (ICLR 2021) Revisiting Locally Supervised Lea

null 78 Dec 27, 2022
Official code repository of the paper Learning Associative Inference Using Fast Weight Memory by Schlag et al.

Learning Associative Inference Using Fast Weight Memory This repository contains the offical code for the paper Learning Associative Inference Using F

Imanol Schlag 18 Oct 12, 2022