DAP#

Arguments#

Options

--sim_lambdafloat

Help: None

  • Default: 0.1

--virtual_bs_nint

Help: virtual batch size iterations

  • Default: 1

--enable_test_time_majority_votingint

Help: Enable majority voting for selecting the prompts during test time. NOTE: This should be avoided as it is not a fair comparison with other methods.

  • Default: 0

--task_embint

Help: task embedding size

  • Default: 16

--num_dap_tokensint

Help: number of dap tokens

  • Default: 10

--load_original_checkpoint0|1|True|False -> bool

Help: load original checkpoint. This requires the file imagenet21k_ViT-B_16.npz to be present in the ./data directory. You can download it following the instructions in https://github.com/naver-ai/dap-cl

  • Default: 0

On the reproducibility of DAP#

The original implementation of DAP is available at https://github.com/naver-ai/dap-cl and features:
  • a custom backbone, available with the –load_original_checkpoint flag

  • majority voting during test time, available with the –enable_test_time_majority_voting flag

  • custom splits for many datasets. Specifically: imagenet-r, chestx, eurosat-rgb, isic, and resisc45 use a validation set of 20% from the training set as the test set, while other datasets use their original splits. This differs from the Mammoth implementation, which follows that of other commonly used works (e.g, eurosat-rgb uses the split of CoOp).

Classes#

class models.dap.DAP(backbone, loss, args, transform, dataset=None)[source]#

Bases: ContinualModel

Generating Instance-level Prompts for Rehearsal-free Continual Learning.

COMPATIBILITY: List[str] = ['class-il', 'task-il']#
NAME: str = 'dap'#
begin_task(dataset)[source]#
forward(x)[source]#
Return type:

Tensor

get_optimizer()[source]#
get_parameters()[source]#
static get_parser(parser)[source]#
Return type:

ArgumentParser

net: DAPModel#
observe(inputs, labels, not_aug_inputs, epoch=None)[source]#