FlyGCL is a practical framework for General Continual Learning (GCL) / online class-incremental learning on images, with a focus on the Si-Blurry setting. It includes multiple pretrained-based baselines built on Vision Transformers (ViT) and a lightweight runner for reproducing experiments. FlyPrompt is our proposed method, which uses random-expanded routing and temporal-ensemble experts to effectively tackle GCL problem, achieving significant gains on major benchmarks.
- Methods:
flyprompt(ours),l2p,dualprompt,codaprompt,mvp,misa,slca,sprompt,ranpac,hide(prompt/lora/adapter),norga,sdlora - Backbones: ViT via
timmand a local ViT implementation (models/vit.py) supporting multiple pretrained sources - Setting: true online Si-Blurry with configurable disjoint/blurry ratios
- Outputs: logs and numpy/json artifacts under
results/
- Python: 3.10+
- PyTorch / CUDA: please follow the official PyTorch instructions for your CUDA version, and then install the remaining dependencies.
We recommend:
python -m venv .venv
source .venv/bin/activate
pip install -U pip
pip install -r requirements.txtNotes:
requirements.txtpins a full stack (includingtorch/torchvision). If you prefer installing PyTorch from a specific CUDA wheel index, install PyTorch first and then install the remaining packages accordingly.
FlyGCL uses --data_dir as the dataset root path. Different datasets expect different sub-structures (please see below).
FlyGCL/
data/ # default ./data
CIFAR/ # for CIFAR-10/100 (torchvision)
imagenet-r/ # for ImageNet-R (see split requirement below)
train/
<class_name>/*.jpg
test/
<class_name>/*.jpg
CUB_200_2011/ # for CUB-200-2011
images/
<class_name>/*.jpg
You may change the root path by:
- CLI:
--data_dir /your/path - Baseline scripts: set
DATA_ROOT=/your/path(scripts use${DATA_ROOT}/CIFAR,${DATA_ROOT}/imagenet-r,${DATA_ROOT}/CUB_200_2011by default)
- CIFAR-100: torchvision can download automatically. Official page:
https://www.cs.toronto.edu/~kriz/cifar.html - ImageNet-R (Rendition):
- Project page:
https://github.com/hendrycks/imagenet-r - Tarball (as referenced in our dataset code comments):
https://people.eecs.berkeley.edu/~hendrycks/imagenet-r.tar - Note: our active loader expects
imagenet-r/train/andimagenet-r/test/. If your download does not include this split, please create a split (e.g., 80/20 per class) and place images intotrain/andtest/folders.
- Project page:
- CUB-200-2011:
- Official page:
https://www.vision.caltech.edu/datasets/cub_200_2011/ - Direct tgz (images+annotations):
https://data.caltech.edu/records/65de6-vp158/files/CUB_200_2011.tgz - After extraction, point
--data_dirto the extractedCUB_200_2011/folder (the one that containsimages/).
- Official page:
The trainer currently calls dataset constructors with download=True, but most custom datasets in datasets/ have download/extract code commented out. In practice:
- CIFAR-10/100 (torchvision) can auto-download into
--data_dir. - Many others (e.g., ImageNet-R, CUB, Cars) require manual download + correct folder structure.
Checkpoint download links:
- Hugging Face: Hugging Face Project
- Baidu Netdisk: Download Link (code:
39wb)
Please create a local folder:
FlyGCL/
checkpoints/
(files listed below)
Notes:
checkpoints/is ignored by git (.gitignore), so you should download and place files manually.models/vit.pywill also look for some.npzweights under~/.cache/torch/hub/checkpoints/(torch hub cache, forvit_base_patch16_224).
When you set --backbone to one of the following, models/vit.py will try to load a local file when pretrained=True:
run.sh also uses vit_base_patch16_224 by default, which requires to put ViT-B_16.npz weights under ~/.cache/torch/hub/checkpoints/.
| Model Name | --backbone value |
Expected file name |
|---|---|---|
| Sup-21K | vit_base_patch16_224 |
ViT-B_16.npz |
| Sup-21K/1K | vit_base_patch16_224_mepo_21k_1k |
vit_21k_1k_mepo_epoch_0.pth |
| iBOT-21K | vit_base_patch16_224_21k_ibot |
checkpoint.pth (expects key teacher) |
| iBOT-1K | vit_base_patch16_224_ibot |
ibot_vitbase16_pretrain.pth |
| DINO-1K | vit_base_patch16_224_dino |
dino_vitbase16_pretrain.pth |
| MoCo v3-1K | vit_base_patch16_224_mocov3 |
mocov3-vit-base-300ep.pth (expects key model) |
MISA (based on DualPrompt) loads prompt tensors from local files when you pass --load_pt:
./checkpoints/g_prompt.pt./checkpoints/e_prompt.pt
Prompt checkpoints are distributed via the same links above.
Single-GPU, CIFAR-100, Si-Blurry (n=50, m=10), 5 tasks:
python main.py \
--method flyprompt \
--dataset cifar100 \
--data_dir ./data/CIFAR \
--backbone vit_base_patch16_224 \
--n_tasks 5 --n 50 --m 10 \
--batchsize 64 --lr 0.005 \
--online_iter 3 --num_epochs 1 \
--use_amp --eval_period 1000 \
--note flyprompt_cifar100ImageNet-R example (requires ./data/imagenet-r/train and ./data/imagenet-r/test):
python main.py \
--method flyprompt \
--dataset imagenet-r \
--data_dir ./data/imagenet-r \
--backbone vit_base_patch16_224 \
--n_tasks 5 --n 50 --m 10 \
--batchsize 32 --lr 0.005 \
--online_iter 3 --num_epochs 1 \
--use_amp --eval_period 1000 \
--note flyprompt_imagenet_rWe provide ready-to-run bash scripts under scripts/:
- Set python interpreter with env var
PYTHON(defaults topython) - Set dataset root with env var
DATA_ROOT(defaults to./data)
Example:
export DATA_ROOT=./data
export PYTHON=python
bash scripts/run_baselines_flyprompt.sh 0 "1 2 3" cifar100 flyprompt_minimalYou can always override the dataset path per run by passing --data_dir ... as extra args:
bash scripts/run_baselines_flyprompt.sh 0 "1 2 3" cifar100 note --data_dir /mnt/datasets/CIFARrun.sh launches many baseline scripts via screen. If you plan to use it, please ensure screen is installed.
- Method/dataset:
--method {flyprompt|l2p|dualprompt|codaprompt|mvp|slca|ranpac|...}--dataset {cifar100|imagenet-r|cub200|...}--data_dir /path - Setting:
--n_tasks 5--n 50(disjoint class ratio, %)--m 10(blurry sample ratio, %) - Training:
--batchsize 64--lr 0.005--online_iter 3--num_epochs 1--use_amp--eval_period 1000 - Backbone:
--backbone vit_base_patch16_224(or one of the local-checkpoint variants) - Repro:
--seeds 1 2 3--note my_experiment
Outputs are stored under results/:
results/
logs/{dataset}/{note}/
seed_{seed}.npy
seed_{seed}_eval.npy # if eval_period is enabled
seed_{seed}_eval_time.npy # if eval_period is enabled
When running via scripts/*.sh, the console output is additionally captured by tee into:
results/logs/{dataset}/{note}/seed_{SEEDS}_log.txt
main.py: entry point (loads args, builds trainer, runs)configuration/config.py: argument definitionsmethods/: trainers (e.g.,methods/flyprompt.py)models/: model components (e.g.,models/flyprompt.py,models/vit.py)datasets/: dataset wrappersscripts/: baseline launchers
We sincerely thank the authors and maintainers of the following open-source projects and resources. Parts of this codebase are adapted from, or inspired by, them:
If this repository helps your research, please cite our paper:
@inproceedings{flyprompt2026,
title={FlyPrompt: Brain-Inspired Random-Expanded Routing with Temporal-Ensemble Experts for General Continual Learning},
author={Yan, Hongwei and Sun, Guanglong and Zhou, Kanglei and Li, Qian and Wang, Liyuan and Zhong, Yi},
booktitle={ICLR},
year={2026}
}If you have any questions, suggestions, please feel free to report issues or contact:
- Maintainer: Hongwei Yan (
yanhw22@mails.tsinghua.edu.cn)
MIT. See LICENSE.
