Skip to main content

A clean and simple library for Continual Learning in PyTorch.

Project description

Continuum

PyPI version Build Status Codacy Badge DOI Documentation Status coverage

A library for PyTorch's loading of datasets in the field of Continual Learning

Aka Continual Learning, Lifelong-Learning, Incremental Learning, etc.

Read the documentation.

Example:

Install from and PyPi:

pip3 install continuum

And run!

from torch.utils.data import DataLoader

from continuum import ClassIncremental
from continuum.datasets import MNIST
from continuum.tasks import split_train_val


scenario = ClassIncremental(
    MNIST("my/data/path", download=True, train=True),
    increment=1,
    initial_increment=5
)

print(f"Number of classes: {scenario.nb_classes}.")
print(f"Number of tasks: {scenario.nb_tasks}.")

for task_id, train_taskset in enumerate(scenario):
    train_taskset, val_taskset = split_train_val(train_taskset, val_split=0.1)
    train_loader = DataLoader(train_taskset, batch_size=32, shuffle=True)
    val_loader = DataLoader(val_taskset, batch_size=32, shuffle=True)

    for x, y, t in train_loader:
        # Do your cool stuff here

Supported Types of Scenarios

Name Acronym  Supported Scenario
New Instances  NI :white_check_mark: Instances Incremental
New Classes  NC :white_check_mark: Classes Incremental
New Instances & Classes  NIC :white_check_mark: Data Incremental

Supported Datasets:

Most dataset from torchvision.dasasets are supported, for the complete list, look at the documentation page on datasets here.

Furthermore some "Meta"-datasets are can be create or used from numpy array or any torchvision.datasets or from a folder for datasets having a tree-like structure or by combining several dataset and creating dataset fellowships!

Indexing

All our continual loader are iterable (i.e. you can for loop on them), and are also indexable.

Meaning that clloader[2] returns the third task (index starts at 0). Likewise, if you want to evaluate after each task, on all seen tasks do clloader_test[:n].

Example of Sample Images from a Continuum scenario

CIFAR10:

Task 0 Task 1 Task 2 Task 3 Task 4

MNIST Fellowship (MNIST + FashionMNIST + KMNIST):

Task 0 Task 1 Task 2

PermutedMNIST:

Task 0 Task 1 Task 2 Task 3 Task 4

RotatedMNIST:

Task 0 Task 1 Task 2 Task 3 Task 4

Citation

If you find this library useful in your work, please consider citing it:

@misc{douillardlesort2020continuum,
  author={Douillard, Arthur and Lesort, Timothée},
  title={Continuum, Data Loaders for Continual Learning},
  publisher={Github},
  journal={Github repository},
  howpublished={\url{https://github.com/Continvvm/continuum}},
  year={2020}
}

Maintainers

This project was started by a joint effort from Arthur Douillard & Timothée Lesort.

Feel free to contribute! If you want to propose new features, please create an issue.

On PyPi

Our project is available on PyPi!

pip3 install continuum

Note that previously another project, a CI tool, was using that name. It is now there continuum_ci.

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

continuum-1.0.5.tar.gz (27.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

continuum-1.0.5-py3-none-any.whl (64.3 kB view details)

Uploaded Python 3

File details

Details for the file continuum-1.0.5.tar.gz.

File metadata

  • Download URL: continuum-1.0.5.tar.gz
  • Upload date:
  • Size: 27.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.24.0 setuptools/46.1.3 requests-toolbelt/0.9.1 tqdm/4.50.2 CPython/3.7.9

File hashes

Hashes for continuum-1.0.5.tar.gz
Algorithm Hash digest
SHA256 c65e3a2c27aa0864a172bd6a708c1b25d61969bae38f852361c2133f8bfa4b20
MD5 8b48e1439885fa072dc67926b4df30fb
BLAKE2b-256 d90e899d4f9c18524de08c6ef0106ad0bac4e3970fd03189e9d0c52e54c284d3

See more details on using hashes here.

File details

Details for the file continuum-1.0.5-py3-none-any.whl.

File metadata

  • Download URL: continuum-1.0.5-py3-none-any.whl
  • Upload date:
  • Size: 64.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.24.0 setuptools/46.1.3 requests-toolbelt/0.9.1 tqdm/4.50.2 CPython/3.7.9

File hashes

Hashes for continuum-1.0.5-py3-none-any.whl
Algorithm Hash digest
SHA256 2a16736795b14db104183b93a4bc85422ae7d1aa889be8290efa52a535b60f67
MD5 4d878e44110baf8d34dd426423a6e0c6
BLAKE2b-256 e6218fe3860521c60dfa33bb067f11e7b6cd65b35689295d9b6ebbe08d0e877f

See more details on using hashes here.

Supported by

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