Implement Your CL Modules
This package provides lots of bases for you to implement your own continual learning modules, including datasets, algorithms, and anything else in the continual learning system. It is totally flexible. In this chapter, I will go through the logic of designing CL modules within this package framework to let you design your own.
You can define your custom CL modules outside the package source code, and specify the _target_
fields in your configs. Suppose you have a project directory tree like this (you can also take my continual learning research project as an example):
βββ my_modules
β βββ cl_datasets
β β βββ __init__.py
β β βββ permuted_mnist.py
β βββ ...
βββ my_configs
β βββ entrance.yaml
β βββ experiment
β β βββ example.yaml
β β βββ ...
β βββ cl_dataset
β β βββ permuted_mnist.yaml
β βββ ...
Simply specify _target_
as my_modules
where your custom modules are.
configs/cl_dataset/permuted_mnist.yaml
_target_: my_modules.cl_datasets.PermutedMNIST
root: data/MNIST
num_tasks: 10
validation_percentage: 0.1
batch_size: 64
num_workers: 10
However, we need to add your project path to the environment variable PYTHONPATH
(this should be done in the beginning of every terminal sessions):
export PYTHONPATH=.
or set PYTHONPATH
every time the commands are executed:
PYTHONPATH=. cltrain ...
If youβre interested in contributing to this package with your custom modules, feel free to submit a pull request!
Back to top