GithubHelp home page GithubHelp logo

lit-leo / cgate Goto Github PK

View Code? Open in Web Editor NEW
19.0 2.0 7.0 178 KB

Unofficial PyTorch implementation of the paper "Conditional Channel Gated Networks for Task-Aware Continual Learning"

License: MIT License

Makefile 0.13% Jupyter Notebook 61.54% Python 38.33%

cgate's Introduction

ChannelGatedCL

This is an unofficial PyTorch implementation of the paper "Conditional Channel Gated Networks for Task-Aware Continual Learning" by Abati et al. (https://arxiv.org/abs/2004.00070).

At the moment, the code implements the task-incremental setting only. I have put some work into implementing class-incremental setup, but it is not finished yet.

I have tried to follow the paper as close as possible, but maybe there are some details I missed/got wrong. So please use this implementation with care and feel free to ask questions and open PRs.

Requirements

  • Python 3.8
  • PyTorch 1.7.1 (was also tested on 1.5.0, may work on some older versions)

The rest required modules are listed in requirements.txt

How to run

  1. Set up a proper configuration by editing config/cfg.py

  2. Run the following command to train the model

make train

  1. All tensorboard logs, checkpoints, and task-incremental accuracies will be stored in results/experiment_tag

To visualize the sparseness of the model and see how many kernels were frozen by each task, check Sparse_visualization.ipynb

Checkpoints

Due to some differences in implementation, the hyperparameters for ResNet18 mentioned in the paper didn't work well. I changed the optimizer and performed upscaling + augmentations to get better quality.

You can download checkpoint with the best results for ResNet18 so far here. For consistency with other experiments, you may unzip it to the results folder.

Notes

There are a couple of differences between my and the original authors' implementation:

  • To speed up the computation, it is assumed that the batch contains elements from one particular task only.

  • I also observed a strange sparsity pattern for all values of lambda_sparse I used (from 0.1 to 0.5). There is free kernels attrition in the first couple of layers when the first 2-3 tasks use all available capacity, but later layers show underuse. This may be a result of the bug, so let me know if you find one :)

cgate's People

Contributors

lit-leo avatar

Stargazers

forest avatar Ma avatar Tuhu avatar Haoran Zhu avatar WangQing avatar Yonas avatar J Kishan avatar Yilia Lv avatar yang geng avatar Raffaello Camoriano avatar shangzengqiang avatar  avatar PeterPu avatar Md Yousuf Harun avatar Wang Bomin avatar  avatar Luu Trung Hieu avatar Davide Abati avatar  avatar

Watchers

James Cloos avatar  avatar

cgate's Issues

MultiHeadClassifier output

Hello,
In the Notes section you are saying that: "To speed up the computation, it is assumed that the batch contains elements from one particular task only.". Are you referring to the validation loader or the train loader?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.