Skip to main content

A continual learning PyTorch package

Project description

Build Status

ContinualFlame

Small lightweight package for Continual Learning in PyTorch.

Installation

For now the package is hosted on TestPyPi. To install it you just need to run:

pip install continual-flame

Usage

To use the package you just need to import it inside your project.

import contflame as cf

At the moment the package contains just the dataset module.

Dataset

This module contains datasets normally used in the continual learning scenario. The main ones are:

  • SplitMNIST - MNIST dataset split in classes. It allows to create different subtasks by including custom subsets of classes.
  • PermutedMNIST - permuted MNIST dataset. It allows to choose the shape of the applied permutation.
  • SplitCIFAR100
  • PermutedCIFAR100

Examples

SplitMNIST

In the following example the training tasks are five binary classification tasks on subsequent pairs of digit (i.e task 1 (0, 1), task 2 (2, 3), ...)

from cont_flame.dataset import SplitMNIST

valid = []
for i in range(1, 10, 2)
  train_dataset = SplitMNIST(classes=[i, i+1], dset='train', valid=0.2)
  valid.append(SplitMNIST(classes=[i, i+1], dset='valid', valid=0.2))

  for e in epochs:
    # train the model on train_dataset
    # ...

  for v in valid:
    # test the model on the current and the previous tasks
    # ...

PermutedMNIST

To get a random permutation set tile to (1, 1). The same random permutation, selected by the task id, will be applied to all the data points.

PermutedMNIST(tile=(1, 1), task=1)
You can also apply the permutation row (or column) wise by setting the corresponding dimension of the tile equal to the one of the image
PermutedMNIST(tile=(1, 28), task=1)
Or try to maintain high level spatial feature by setting a bigger tile.
PermutedMNIST(tile=(8, 8), task=1)

To get the images without any permutation set the tile to (28, 28) (default value).

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

continual-flame-1.0.tar.gz (9.7 kB view details)

Uploaded Source

Built Distribution

continual_flame-1.0-py3-none-any.whl (21.3 kB view details)

Uploaded Python 3

File details

Details for the file continual-flame-1.0.tar.gz.

File metadata

  • Download URL: continual-flame-1.0.tar.gz
  • Upload date:
  • Size: 9.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/3.10.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.59.0 CPython/3.8.5

File hashes

Hashes for continual-flame-1.0.tar.gz
Algorithm Hash digest
SHA256 77c880b47e49eb1d843c4247f221a0e4a5aec37a142bf855338efa8be39f5bf1
MD5 8f124643ca667000577e55dd7d505d85
BLAKE2b-256 da6a1cb07943013562a18140ff42f6c3bba8ea7bd07c92c3ad0e33c1651af74a

See more details on using hashes here.

File details

Details for the file continual_flame-1.0-py3-none-any.whl.

File metadata

  • Download URL: continual_flame-1.0-py3-none-any.whl
  • Upload date:
  • Size: 21.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/3.10.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.59.0 CPython/3.8.5

File hashes

Hashes for continual_flame-1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 54445c365d41014d781a936166cfcaf4df031f7e37cd2cbb98ef74470ffd40e7
MD5 4edca8513d85a12d334f8b03af3c5cfa
BLAKE2b-256 a7c44943662f2d1e513ce7314db9bbc42e9b5d6a43d5626030ebb881356d1bcd

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page