mmasana / FACIL

Framework for Analysis of Class-Incremental Learning with 12 state-of-the-art methods and 3 baselines.
https://arxiv.org/pdf/2010.15277.pdf
MIT License
512 stars 98 forks source link

Unable to save models (--save-models: save trained models) #27

Closed andreadaou closed 1 year ago

andreadaou commented 1 year ago

Hello @mmasana ,

I appreciate your amazing and extremely helpful work.

Is it possible to save the trained models after incremental learning? The code is not working when putting save_models as True. Appreciate your help!

!python3 -u src/main_incremental.py --approach bic --num-exemplars 2000 --save-models True

============================================================================================================
Arguments =
    approach: bic
    batch_size: 64
    clipping: 10000
    datasets: ['cifar100']
    eval_on_train: False
    exp_name: None
    fix_bn: False
    gpu: 0
    gridsearch_tasks: -1
    keep_existing_head: False
    last_layer_analysis: False
    log: ['disk']
    lr: 0.1
    lr_factor: 3
    lr_min: 0.0001
    lr_patience: 5
    momentum: 0.0
    multi_softmax: False
    nc_first_task: None
    nepochs: 200
    network: resnet32
    no_cudnn_deterministic: False
    num_tasks: 4
    num_workers: 4
    pin_memory: False
    pretrained: False
    results_path: ../results
    save_models: True
    seed: 0
    stop_at_task: 0
    use_valid_only: False
    warmup_lr_factor: 1.0
    warmup_nepochs: 0
    weight_decay: 0.0
============================================================================================================
Approach arguments =
    T: 2
    lamb: -1
    num_bias_epochs: 200
    val_exemplar_percentage: 0.1
============================================================================================================
Exemplars dataset arguments =
    exemplar_selection: random
    num_exemplars: 2000
    num_exemplars_per_class: 0
============================================================================================================
Traceback (most recent call last):
  File "src/main_incremental.py", line 316, in <module>
    main()
  File "src/main_incremental.py", line 178, in main
    assert len(extra_args) == 0, "Unused args: {}".format(' '.join(extra_args))
AssertionError: Unused args: True
mmasana commented 1 year ago

Hi @andreadaou ,

happy to hear that you enjoy our work! The argument --save-models does not require of the True afterwards. I believe that's why you get the error, and if you run the command as !python3 -u src/main_incremental.py --approach bic --num-exemplars 2000 --save-models , it should work fine.

andreadaou commented 1 year ago

Oh okay! Thank you!!!

Hi @andreadaou ,

happy to hear that you enjoy our work! The argument --save-models does not require of the True afterwards. I believe that's why you get the error, and if you run the command as !python3 -u src/main_incremental.py --approach bic --num-exemplars 2000 --save-models , it should work fine.