Coder Social home page Coder Social logo

albinsou / ocl_survey Goto Github PK

View Code? Open in Web Editor NEW
31.0 6.0 9.0 12.32 MB

Code for "A Comprehensive Empirical Evaluation on Online Continual Learning" ICCVW 2023 VCL Workshop

Home Page: https://arxiv.org/abs/2308.10328

License: MIT License

Python 88.17% Shell 0.93% Jupyter Notebook 10.90%
continual learning lifelong online sustainable

ocl_survey's Introduction

OCL Survey Code

Screenshot from 2023-10-12 18-33-31

Code for the paper A Comprehensive Empirical Evaluation on Online Continual Learning, Albin Soutif--Cormerais, Antonio Carta, Andrea Cossu, Julio Hurtado, Hamed Hemati, Vincenzo Lomonaco, Joost van de Weijer, ICCV Workshop 2023 arxiv

This repository is meant to serve as an extensible codebase to perform experiments on the Online Continual Learning setting. It is based on the avalanche library. Feel free to use it for your own experiments. You can also contribute and add your own method and benchmarks to the comparison by doing a pull request !

Installation

Clone this repository

git clone https://github.com/AlbinSou/ocl_survey.git

Create a new environment with python 3.10

conda create -n ocl_survey python=3.10
conda activate ocl_survey

Install specific ocl_survey repo dependencies

pip install -r requirements.txt

Set your PYTHONPATH as the root of the project

conda env config vars set PYTHONPATH=/home/.../ocl_survey

In order to let the scripts know where to fetch and log data, you should also create a deploy config, indicating where the results should be stored and the datasets fetched. Either add a new one or change the content of config/deploy/default.yaml

Lastly, test the environment by launching main.py

cd experiments/
python main.py strategy=er experiment=split_cifar100

Structure

The code is structured as follows:

├── avalanche.git # Avalanche-Lib code
├── config # Hydra config files
│   ├── benchmark
│   ├── best_configs # Best configs found by main_hp_tuning.py are stored here
│   ├── deploy # Contains machine specific results and data path
│   ├── evaluation # Manage evaluation frequency and parrallelism
│   ├── experiment # Manage general experiment settings
│   ├── model
│   ├── optimizer
│   ├── scheduler
│   └── strategy
├── experiments
│   ├── main_hp_tuning.py # Main script used for hyperparameter optimization
│   ├── main.py # Main script used to launch single experiments
│   └── spaces.py
├── notebooks
├── results # Exemple results structure containing results for ER
├── scripts
    └── get_results.py # Easily collect results from multiple seeds
├── src
│   ├── factories # Contains the Benchmark, Method, and Model creation
│   ├── strategies # Contains code for additional strategies or plugins
│   └── toolkit
└── tests

Experiments launching

To launch an experiment, start from the default config file and change the part that needs to change

python main.py strategy=er_ace experiment=split_cifar100 evaluation=parallel

It's also possible to override more fine-grained arguments

python main.py strategy=er_ace experiment=split_cifar100 evaluation=parallel strategy.alpha=0.7 optimizer.lr=0.05

Finally, to use the parameters found by the hyperparameter search, use

python main.py strategy=er_ace experiment=split_cifar100 +best_configs=split_cifar100/er_ace

Before running the script, you can display the full config with "-c job" option

python main.py strategy=er_ace experiment=split_cifar100 evaluation=parallel -c job

Results will be saved in the directory specified in results.yaml. Under the following structure:

<results_dir>/<strategy_name>_<benchmark_name>/<seed>/

Hyperparameter selection

Modify the strategy specific search parameters, search range etc ... inside main_hp_tuning.py then run

python main_hp_tuning.py strategy=er_ace experiment=split_cifar100

Citation

If you use this repo for a research project please use the following citation:

@inproceedings{soutif2023comprehensive,
  title={A comprehensive empirical evaluation on online continual learning},
  author={Soutif-Cormerais, Albin and Carta, Antonio and Cossu, Andrea and Hurtado, Julio and Lomonaco, Vincenzo and Van de Weijer, Joost and Hemati, Hamed},
  booktitle={Proceedings of the IEEE/CVF International Conference on Computer Vision},
  pages={3518--3528},
  year={2023}
}

ocl_survey's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

ocl_survey's Issues

can reproduce er result, but cannot reproduce scr result

For efficiency, i only run strategy ER, GDumb(OOM), SCR.
The ER result can be reproduced as the paper. However, the scr result is unexpected low as listed below.
Are there any hyper-params incorrectly beint set for SCR? i provide my yaml config below.
Thanks~

# ER result
-- >> End of eval phase << --
	CumulativeAccuracy/eval_phase/test_stream/Exp000 = 0.6660
	CumulativeAccuracy/eval_phase/test_stream/Exp001 = 0.6590
	CumulativeAccuracy/eval_phase/test_stream/Exp002 = 0.5780
	CumulativeAccuracy/eval_phase/test_stream/Exp003 = 0.5680
	CumulativeAccuracy/eval_phase/test_stream/Exp004 = 0.5356
	CumulativeAccuracy/eval_phase/test_stream/Exp005 = 0.5037
	CumulativeAccuracy/eval_phase/test_stream/Exp006 = 0.4677
	CumulativeAccuracy/eval_phase/test_stream/Exp007 = 0.4510
	CumulativeAccuracy/eval_phase/test_stream/Exp008 = 0.4353
	CumulativeAccuracy/eval_phase/test_stream/Exp009 = 0.4314
	CumulativeAccuracy/eval_phase/test_stream/Exp010 = 0.4158
	CumulativeAccuracy/eval_phase/test_stream/Exp011 = 0.4058
	CumulativeAccuracy/eval_phase/test_stream/Exp012 = 0.3863
	CumulativeAccuracy/eval_phase/test_stream/Exp013 = 0.3749
	CumulativeAccuracy/eval_phase/test_stream/Exp014 = 0.3673
	CumulativeAccuracy/eval_phase/test_stream/Exp015 = 0.3554
	CumulativeAccuracy/eval_phase/test_stream/Exp016 = 0.3505
	CumulativeAccuracy/eval_phase/test_stream/Exp017 = 0.3481
	CumulativeAccuracy/eval_phase/test_stream/Exp018 = 0.3338
	CumulativeAccuracy/eval_phase/test_stream/Exp019 = 0.2820
	Loss_Stream/eval_phase/test_stream/Task000 = 4.3728
	Top1_Acc_Stream/eval_phase/test_stream/Task000 = 0.2820
# SCR result
-- >> End of eval phase << --
	CumulativeAccuracy/eval_phase/test_stream/Exp000 = 0.5300
	CumulativeAccuracy/eval_phase/test_stream/Exp001 = 0.4610
	CumulativeAccuracy/eval_phase/test_stream/Exp002 = 0.3460
	CumulativeAccuracy/eval_phase/test_stream/Exp003 = 0.2770
	CumulativeAccuracy/eval_phase/test_stream/Exp004 = 0.2276
	CumulativeAccuracy/eval_phase/test_stream/Exp005 = 0.1993
	CumulativeAccuracy/eval_phase/test_stream/Exp006 = 0.1731
	CumulativeAccuracy/eval_phase/test_stream/Exp007 = 0.1568
	CumulativeAccuracy/eval_phase/test_stream/Exp008 = 0.1427
	CumulativeAccuracy/eval_phase/test_stream/Exp009 = 0.1338
	CumulativeAccuracy/eval_phase/test_stream/Exp010 = 0.1235
	CumulativeAccuracy/eval_phase/test_stream/Exp011 = 0.1202
	CumulativeAccuracy/eval_phase/test_stream/Exp012 = 0.1112
	CumulativeAccuracy/eval_phase/test_stream/Exp013 = 0.1040
	CumulativeAccuracy/eval_phase/test_stream/Exp014 = 0.0972
	CumulativeAccuracy/eval_phase/test_stream/Exp015 = 0.0909
	CumulativeAccuracy/eval_phase/test_stream/Exp016 = 0.0861
	CumulativeAccuracy/eval_phase/test_stream/Exp017 = 0.0812
	CumulativeAccuracy/eval_phase/test_stream/Exp018 = 0.0801
	CumulativeAccuracy/eval_phase/test_stream/Exp019 = 0.0761
	Loss_Stream/eval_phase/test_stream/Task000 = 4.4721
	Top1_Acc_Stream/eval_phase/test_stream/Task000 = 0.0761
# yaml config for SCR
benchmark:
  factory_args:
    return_task_id: false
    shuffle: true
    class_ids_from_zero_in_each_exp: false
    class_ids_from_zero_from_first_exp: true
    benchmark_name: split_cifar100
    n_experiences: 20
    val_size: 0.0
    use_transforms: false
    fixed_class_order: null
  dataset_name: cifar100
  dataset_root: /data2/defeng_data/ocil/ocl_survey_data
scheduler:
  type: null
optimizer:
  type: SGD
  lr: 0.1
  momentum: 0.0
  weight_decay: 0.0
model:
  model_type: slim_resnet18
strategy:
  mem_size: 2000
  batch_size_mem: 118
  train_mb_size: 10
  eval_mb_size: 128
  train_epochs: 3
  device: cuda
  use_task_boundaries: false
  name: scr
  temperature: 1.0
evaluation:
  peval_mode: experience
  eval_every: -1
  metrics:
  - accuracy_metrics
  - cumulative_accuracy
  - loss_metrics
  - clock
  - time
  loggers_strategy:
  - interactive
  - text
  - tensorboard
  - json
  num_gpus: 1
  num_cpus: 8
  num_actors: 3
experiment:
  results_root: ./results
  seed: 0
  save_models: false
  train_online: true
  logdir: ./results/scr_split_cifar100_20_2000/0
  debug: false
# running command
python main.py experiment=split_cifar100 strategy=scr

Error in computation of results

I trained the experiment and was analyzing the results with the ipynb files in notebooks folder and following is what I get,

frames = extract_results("/data/hvaidya/ocl_survey/results/er_split_cifar100_20_2000/")
print(frames)
df = frames["training"]

---------------------------------------------------------------------------
NotImplementedError                       Traceback (most recent call last)
[/data/hvaidya/ocl_survey/notebooks/results.ipynb](https://vscode-remote+ssh-002dremote-002bgaivi-002ecse-002eusf-002eedu.vscode-resource.vscode-cdn.net/data/hvaidya/ocl_survey/notebooks/results.ipynb) Cell 3 line 1
----> [1](vscode-notebook-cell://ssh-remote%2Bgaivi.cse.usf.edu/data/hvaidya/ocl_survey/notebooks/results.ipynb#W2sdnNjb2RlLXJlbW90ZQ%3D%3D?line=0) df = compute_average_forgetting(df, 20, base_name="Top1_Acc_Exp/eval_phase/valid_stream/Task000/Exp")
      [2](vscode-notebook-cell://ssh-remote%2Bgaivi.cse.usf.edu/data/hvaidya/ocl_survey/notebooks/results.ipynb#W2sdnNjb2RlLXJlbW90ZQ%3D%3D?line=1) df = compute_AAA(df)

File [/data/hvaidya/ocl_survey/src/toolkit/post_metrics.py:79](https://vscode-remote+ssh-002dremote-002bgaivi-002ecse-002eusf-002eedu.vscode-resource.vscode-cdn.net/data/hvaidya/ocl_survey/src/toolkit/post_metrics.py:79), in compute_average_forgetting(dataframe, num_exp, base_name, name)
     77 for i in range(num_exp):
     78     mname = base_name + f"{i:03d}"
---> 79     dataframe = compute_forgetting(dataframe, mname)
     80     metric_names.append(prefix + mname)
     82 df = compute_average(dataframe, metric_names, name)

File [/data/hvaidya/ocl_survey/src/toolkit/post_metrics.py:28](https://vscode-remote+ssh-002dremote-002bgaivi-002ecse-002eusf-002eedu.vscode-resource.vscode-cdn.net/data/hvaidya/ocl_survey/src/toolkit/post_metrics.py:28), in compute_forgetting(dataframe, metric_name, prefix)
     25 df = dataframe.sort_values("mb_index")
     27 if "valid_stream" in metric_name:
---> 28     raise NotImplementedError(
     29         "The compututation of forgetting on continual metric streams is not supported"
     30     )
     31     df = decorate_with_training_task(
     32         df, base_name="Top1_Acc_Exp/eval_phase/valid_stream/Task000/Exp"
     33     )
     34 else:

NotImplementedError: The compututation of forgetting on continual metric streams is not supported

can you help me with this?

got stuck in somethere when try start a experiment.

i set up the environment following the section installation in README.

i launch the demo experiment using command "python main.py strategy=er experiment=split_cifar100"
and the program is frozen at this stage as shown in the image.

how can i solve this problem? thanks a lot.

image

What is n_experiences?

What is n_experiences in config/benchmarks/split_cifar100.yaml?
If I want to run experiment on cifar-10 with 5 tasks each having 2 classes, wouldn't n_eperiences be 2 in that case?
Also, get_results.py always has 20 set by default at various places. Shouldn't that be equal to 20?
If I create a new cifar-10 config file with n_experiences: 2, the experiement runs only for 1 task. Shouldn't it run untill 5 tasks?

errors while evaluating it on split-CIFAR10

I am trying to evaluate your code on cifar-10 and for that I created all the required .yaml files in /benchmark, /experiment folders using the values obtained from files specific to cifar100. I initialized n_experiences: 2 in split_cifar10.yaml that I created in /benchmark folder.

I am getting the following error,

Error executing job with overrides: ['strategy=er', 'experiment=split_cifar10', 'strategy.train_epochs=1']
Traceback (most recent call last):
  File "/data/hvaidya/ocl_survey/experiments/main.py", line 127, in <module>
    main()
  File "/home/h/hvaidya/.conda/envs/ocl_survey/lib/python3.10/site-packages/hydra/main.py", line 94, in decorated_main
    _run_hydra(
  File "/home/h/hvaidya/.conda/envs/ocl_survey/lib/python3.10/site-packages/hydra/_internal/utils.py", line 394, in _run_hydra
    _run_app(
  File "/home/h/hvaidya/.conda/envs/ocl_survey/lib/python3.10/site-packages/hydra/_internal/utils.py", line 457, in _run_app
    run_and_report(
  File "/home/h/hvaidya/.conda/envs/ocl_survey/lib/python3.10/site-packages/hydra/_internal/utils.py", line 223, in run_and_report
    raise ex
  File "/home/h/hvaidya/.conda/envs/ocl_survey/lib/python3.10/site-packages/hydra/_internal/utils.py", line 220, in run_and_report
    return func()
  File "/home/h/hvaidya/.conda/envs/ocl_survey/lib/python3.10/site-packages/hydra/_internal/utils.py", line 458, in <lambda>
    lambda: hydra.run(
  File "/home/h/hvaidya/.conda/envs/ocl_survey/lib/python3.10/site-packages/hydra/_internal/hydra.py", line 132, in run
    _ = ret.return_value
  File "/home/h/hvaidya/.conda/envs/ocl_survey/lib/python3.10/site-packages/hydra/core/utils.py", line 260, in return_value
    raise self._return_value
  File "/home/h/hvaidya/.conda/envs/ocl_survey/lib/python3.10/site-packages/hydra/core/utils.py", line 186, in run_job
    ret.return_value = task_function(task_cfg)
  File "/data/hvaidya/ocl_survey/experiments/main.py", line 82, in main
    strategy = method_factory.create_strategy(
  File "/data/hvaidya/ocl_survey/src/factories/method_factory.py", line 319, in create_strategy
    cl_strategy = [strategy](**strategy_dict, plugins=plugins)
TypeError: 'list' object is not callable

Upon checking the values of model and optimizer I found that they are initialized as per the config files. The error is thrown at line 295 cl_strategy = globals()[strategy](**strategy_dict, plugins=plugins) in method_factory.py in src/factories folder.

Please let me know if you need the .yaml files that I created for split-cifar10.

Thank you!

AssertionError: no class means available for icarl strategy

I set n_experiences=10 for split-cifar10 and task_boundaries=False at line 98 in main.py. I get the following error while running the experiment

(ocl_survey) [[email protected]@GPU6 experiments]$ HYDRA_FULL_ERROR=1 python main.py strategy=icarl experiment=split_cifar10 evaluation=parallel strategy.train_epochs=1 strategy.mem_size=2000                
/data/hvaidya/ocl_survey/experiments/main.py:21: UserWarning:                                                                                                                                                       
The version_base parameter is not specified.                                                                                                                                                                        
Please specify a compatability version level, or None.                                                                                                                                                              
Will assume defaults for version 1.1                                                                                                                                                                                
  @hydra.main(config_path="../config", config_name="config.yaml")                                                                                                                                                   
/home/h/hvaidya/.conda/envs/ocl_survey/lib/python3.10/site-packages/hydra/_internal/hydra.py:119: UserWarning: Future Hydra versions will no longer change working directory at job runtime by default.             
See https://hydra.cc/docs/1.2/upgrades/1.1_to_1.2/changes_to_job_working_dir/ for more information.                                                                                                                 
  ret = run_job(                                                                                                                                                                                                    
Files already downloaded and verified                                                                                                                                                                               
Files already downloaded and verified                                                                                                                                                                               
[4, 1, 7, 5, 3, 9, 0, 8, 6, 2]                                                                                                                                                                                      
SGD (                                                                                                                                                                                                               
Parameter Group 0                                                                                                                                                                                                   
    dampening: 0                                                                                                                                                                                                    
    differentiable: False                                                                                                                                                                                           
    foreach: None                                                                                                                                                                                                   
    lr: 0.1                                                                                                                                                                                                         
    maximize: False                                                                                                                                                                                                 
    momentum: 0.0                                                                                                                                                                                                   
    nesterov: False                                                                                                                                                                                                 
    weight_decay: 0.0                                                                                                                                                                                               
)                                                                                                                                                                                                                   
Using strategy:  OnlineICaRL                                                                                                                                                                                        
With plugins:  [<src.toolkit.parallel_eval.ParallelEvaluationPlugin object at 0x7f41779fee00>, <src.strategies.icarl._ICaRLPlugin object at 0x7f41434727a0>, <avalanche.training.plugins.replay.ReplayPlugin object 
at 0x7f41434731f0>, <src.strategies.icarl.OnlineICaRLLossPlugin object at 0x7f4177bb0f10>, <avalanche.training.plugins.evaluation.EvaluationPlugin object at 0x7f4177bb0b80>, <avalanche.training.templates.base_sgd
.PeriodicEval object at 0x7f4143472890>, <avalanche.training.plugins.clock.Clock object at 0x7f41434728f0>]                                                                                                         
-- >> Start of training phase << --                                                                                                                                                                                 
-- Starting training on experience 0 (Task 0) from train stream --                                                                                                                                                  
  0%|▎                                                                                                                                                                              | 1/475 [00:03<25:52,  3.28s/it]
Error executing job with overrides: ['strategy=icarl', 'experiment=split_cifar10', 'evaluation=parallel', 'strategy.train_epochs=1', 'strategy.mem_size=2000']                                                      
Traceback (most recent call last):                                                                                                                                                                                  
  File "/data/hvaidya/ocl_survey/experiments/main.py", line 129, in <module>                                                                                                                                        
    main()                                                                                                                                                                                                          
  File "/home/h/hvaidya/.conda/envs/ocl_survey/lib/python3.10/site-packages/hydra/main.py", line 94, in decorated_main                                                                                              
    _run_hydra(                                                                                                                                                                                                     
  File "/home/h/hvaidya/.conda/envs/ocl_survey/lib/python3.10/site-packages/hydra/_internal/utils.py", line 394, in _run_hydra                                                                                      
    _run_app(                                                                                                                                                                                                       
  File "/home/h/hvaidya/.conda/envs/ocl_survey/lib/python3.10/site-packages/hydra/_internal/utils.py", line 457, in _run_app                                                                                        
    run_and_report(                                                                                                                                                                                                 
  File "/home/h/hvaidya/.conda/envs/ocl_survey/lib/python3.10/site-packages/hydra/_internal/utils.py", line 223, in run_and_report                                                                                  
    raise ex                                                                                                                                                                                                        
  File "/home/h/hvaidya/.conda/envs/ocl_survey/lib/python3.10/site-packages/hydra/_internal/utils.py", line 220, in run_and_report                                                                                  
    return func()                                                                                                                                                                                                   
  File "/home/h/hvaidya/.conda/envs/ocl_survey/lib/python3.10/site-packages/hydra/_internal/utils.py", line 458, in <lambda>                                                                                        
    lambda: hydra.run(                                                                                                                                                                                              
  File "/home/h/hvaidya/.conda/envs/ocl_survey/lib/python3.10/site-packages/hydra/_internal/hydra.py", line 132, in run                                                                                             
    _ = ret.return_value                                                                                                                                                                                            
  File "/home/h/hvaidya/.conda/envs/ocl_survey/lib/python3.10/site-packages/hydra/core/utils.py", line 260, in return_value                                                                                         
    raise self._return_value                                                                                                                                                                                        
  File "/home/h/hvaidya/.conda/envs/ocl_survey/lib/python3.10/site-packages/hydra/core/utils.py", line 186, in run_job                                                                                              
    ret.return_value = task_function(task_cfg)                                                                                                                                                                      
  File "/data/hvaidya/ocl_survey/experiments/main.py", line 109, in main                                                                                                                                            
    strategy.train(                                                                                                                                                                                                 
  File "/home/h/hvaidya/.conda/envs/ocl_survey/lib/python3.10/site-packages/avalanche/training/templates/base_sgd.py", line 168, in train                                                                           
    super().train(experiences, eval_streams, **kwargs)                                                                                                                                                              
  File "/home/h/hvaidya/.conda/envs/ocl_survey/lib/python3.10/site-packages/avalanche/training/templates/base.py", line 144, in train                                                                               
    self._train_exp(self.experience, eval_streams, **kwargs)                                                                                                         
  File "/home/h/hvaidya/.conda/envs/ocl_survey/lib/python3.10/site-packages/avalanche/training/templates/base_sgd.py", line 294, in _train_exp                                                                      
    self.training_epoch(**kwargs)
  File "/home/h/hvaidya/.conda/envs/ocl_survey/lib/python3.10/site-packages/avalanche/training/templates/update_type/sgd_update.py", line 22, in training_epoch
    self._before_forward(**kwargs)
  File "/home/h/hvaidya/.conda/envs/ocl_survey/lib/python3.10/site-packages/avalanche/training/templates/base_sgd.py", line 473, in _before_forward
    trigger_plugins(self, "before_forward", **kwargs)
  File "/home/h/hvaidya/.conda/envs/ocl_survey/lib/python3.10/site-packages/avalanche/training/utils.py", line 69, in trigger_plugins
    getattr(p, event)(strategy, **kwargs)
  File "/data/hvaidya/ocl_survey/src/strategies/icarl.py", line 52, in before_forward
    self.old_logits = self.old_model(strategy.mb_x)
  File "/home/h/hvaidya/.conda/envs/ocl_survey/lib/python3.10/site-packages/torch/nn/modules/module.py", line 1518, in _wrapped_call_impl
    return self._call_impl(*args, **kwargs)
  File "/home/h/hvaidya/.conda/envs/ocl_survey/lib/python3.10/site-packages/torch/nn/modules/module.py", line 1527, in _call_impl
    return forward_call(*args, **kwargs)
  File "/home/h/hvaidya/.conda/envs/ocl_survey/lib/python3.10/site-packages/avalanche/models/dynamic_modules.py", line 460, in forward
    return self.eval_classifier(x)
  File "/home/h/hvaidya/.conda/envs/ocl_survey/lib/python3.10/site-packages/torch/nn/modules/module.py", line 1518, in _wrapped_call_impl
    return self._call_impl(*args, **kwargs)
  File "/home/h/hvaidya/.conda/envs/ocl_survey/lib/python3.10/site-packages/torch/nn/modules/module.py", line 1527, in _call_impl
    return forward_call(*args, **kwargs)
  File "/home/h/hvaidya/.conda/envs/ocl_survey/lib/python3.10/site-packages/torch/utils/_contextlib.py", line 115, in decorate_context
    return func(*args, **kwargs)
  File "/home/h/hvaidya/.conda/envs/ocl_survey/lib/python3.10/site-packages/avalanche/models/ncm_classifier.py", line 77, in forward
    assert self.class_means_dict != {}, "no class means available."
AssertionError: no class means available.
Exception ignored in atexit callback: <bound method BlockingScheduler.close of <src.toolkit.parallel_eval.BlockingScheduler object at 0x7f4177b5df60>>
Traceback (most recent call last):
  File "/data/hvaidya/ocl_survey/src/toolkit/parallel_eval.py", line 37, in close
    ray.get(self.scheduled_tasks)
  File "/home/h/hvaidya/.conda/envs/ocl_survey/lib/python3.10/site-packages/ray/_private/auto_init_hook.py", line 24, in auto_init_wrapper
    return fn(*args, **kwargs)
  File "/home/h/hvaidya/.conda/envs/ocl_survey/lib/python3.10/site-packages/ray/_private/client_mode_hook.py", line 103, in wrapper
    return func(*args, **kwargs)
  File "/home/h/hvaidya/.conda/envs/ocl_survey/lib/python3.10/site-packages/ray/_private/worker.py", line 2524, in get
    raise value.as_instanceof_cause()
ray.exceptions.RayTaskError(AssertionError): ray::EvaluationActor.eval() (pid=959167, ip=10.10.10.6, actor_id=6004a1dcca0184816d26c34101000000, repr=<src.toolkit.parallel_eval.EvaluationActor object at 0x7f05f22b
6e30>)
  File "/data/hvaidya/ocl_survey/src/toolkit/parallel_eval.py", line 66, in eval
    self.strat.eval(stream, **kwargs)
  File "/home/h/hvaidya/.conda/envs/ocl_survey/lib/python3.10/site-packages/torch/utils/_contextlib.py", line 115, in decorate_context
    return func(*args, **kwargs)
  File "/home/h/hvaidya/.conda/envs/ocl_survey/lib/python3.10/site-packages/avalanche/training/templates/base_sgd.py", line 183, in eval
    super().eval(exp_list, **kwargs)
  File "/home/h/hvaidya/.conda/envs/ocl_survey/lib/python3.10/site-packages/torch/utils/_contextlib.py", line 115, in decorate_context
    return func(*args, **kwargs)
  File "/home/h/hvaidya/.conda/envs/ocl_survey/lib/python3.10/site-packages/avalanche/training/templates/base.py", line 193, in eval
    self._eval_exp(**kwargs)
  File "/home/h/hvaidya/.conda/envs/ocl_survey/lib/python3.10/site-packages/avalanche/training/templates/base_sgd.py", line 187, in _eval_exp
    self.eval_epoch(**kwargs)
  File "/home/h/hvaidya/.conda/envs/ocl_survey/lib/python3.10/site-packages/avalanche/training/templates/base_sgd.py", line 229, in eval_epoch
    self.mb_output = self.forward()
  File "/home/h/hvaidya/.conda/envs/ocl_survey/lib/python3.10/site-packages/avalanche/training/templates/problem_type/supervised_problem.py", line 39, in forward
    return avalanche_forward(self.model, self.mb_x, self.mb_task_id)
  File "/home/h/hvaidya/.conda/envs/ocl_survey/lib/python3.10/site-packages/avalanche/models/utils.py", line 21, in avalanche_forward
    return model(x)
  File "/home/h/hvaidya/.conda/envs/ocl_survey/lib/python3.10/site-packages/torch/nn/modules/module.py", line 1518, in _wrapped_call_impl
    return self._call_impl(*args, **kwargs)
  File "/home/h/hvaidya/.conda/envs/ocl_survey/lib/python3.10/site-packages/torch/nn/modules/module.py", line 1527, in _call_impl
    return forward_call(*args, **kwargs)
  File "/home/h/hvaidya/.conda/envs/ocl_survey/lib/python3.10/site-packages/avalanche/models/dynamic_modules.py", line 460, in forward
    return self.eval_classifier(x)
  File "/home/h/hvaidya/.conda/envs/ocl_survey/lib/python3.10/site-packages/torch/nn/modules/module.py", line 1518, in _wrapped_call_impl
    return self._call_impl(*args, **kwargs)
  File "/home/h/hvaidya/.conda/envs/ocl_survey/lib/python3.10/site-packages/torch/nn/modules/module.py", line 1527, in _call_impl
    return forward_call(*args, **kwargs)
  File "/home/h/hvaidya/.conda/envs/ocl_survey/lib/python3.10/site-packages/torch/utils/_contextlib.py", line 115, in decorate_context
    return func(*args, **kwargs)
  File "/home/h/hvaidya/.conda/envs/ocl_survey/lib/python3.10/site-packages/avalanche/models/ncm_classifier.py", line 77, in forward
    assert self.class_means_dict != {}, "no class means available."
AssertionError: no class means available.
  0%|▎   

TypeError: BaseSGDTemplate.__init__() missing 2 required positional arguments: 'model' and 'optimizer'

I am trying to run this code and get the above mentioned error.

My shell script looks like this,

cd /data/hvaidya/ocl_survey/experiments
HYDRA_FULL_ERROR=1 python main.py strategy=er_ace experiment=split_cifar100 strategy.train_epochs=1

I changed the default dataset_root in default.yaml in deploy folder because there is no /DATA folder therefore that throws an error. But it got resolved after I mentioned custom dataset root.

benchmark:
  dataset_root: /data/hvaidya/ #/DATA/data

When I run the shell script, I get the following error.

/data/hvaidya/ocl_survey/experiments/main.py:20: UserWarning: 
The version_base parameter is not specified.
Please specify a compatability version level, or None.
Will assume defaults for version 1.1
  @hydra.main(config_path="../config", config_name="config.yaml")
/home/h/hvaidya/.conda/envs/ocl_survey/lib/python3.10/site-packages/hydra/_internal/hydra.py:119: UserWarning: Future Hydra versions will no longer change working directory at job runtime by default.
See https://hydra.cc/docs/1.2/upgrades/1.1_to_1.2/changes_to_job_working_dir/ for more information.
  ret = run_job(
Files already downloaded and verified
Files already downloaded and verified
[44, 19, 93, 90, 71, 69, 37, 95, 53, 91, 81, 42, 80, 85, 74, 56, 76, 63, 82, 40, 26, 92, 57, 10, 16, 66, 89, 41, 97, 8, 31, 24, 35, 30, 65, 7, 98, 23, 20, 29, 78, 61, 94, 15, 4, 52, 59, 5, 54, 46, 3, 28, 2, 70, 6, 60, 49, 68, 55, 72, 79, 77, 45, 1, 32, 34, 11, 0, 22, 12, 87, 50, 25, 47, 36, 96, 9, 83, 62, 84, 18, 17, 75, 67, 13, 48, 39, 21, 64, 88, 38, 27, 14, 73, 33, 58, 86, 43, 99, 51]
SGD (
Parameter Group 0
    dampening: 0
    differentiable: False
    foreach: None
    lr: 0.1
    maximize: False
    momentum: 0.0
    nesterov: False
    weight_decay: 0.0
)
Error executing job with overrides: ['strategy=er_ace', 'experiment=split_cifar100', 'strategy.train_epochs=1']
Traceback (most recent call last):
  File "/data/hvaidya/ocl_survey/experiments/main.py", line 126, in <module>
    main()
  File "/home/h/hvaidya/.conda/envs/ocl_survey/lib/python3.10/site-packages/hydra/main.py", line 94, in decorated_main
    _run_hydra(
  File "/home/h/hvaidya/.conda/envs/ocl_survey/lib/python3.10/site-packages/hydra/_internal/utils.py", line 394, in _run_hydra
    _run_app(
  File "/home/h/hvaidya/.conda/envs/ocl_survey/lib/python3.10/site-packages/hydra/_internal/utils.py", line 457, in _run_app
    run_and_report(
  File "/home/h/hvaidya/.conda/envs/ocl_survey/lib/python3.10/site-packages/hydra/_internal/utils.py", line 223, in run_and_report
    raise ex
  File "/home/h/hvaidya/.conda/envs/ocl_survey/lib/python3.10/site-packages/hydra/_internal/utils.py", line 220, in run_and_report
    return func()
  File "/home/h/hvaidya/.conda/envs/ocl_survey/lib/python3.10/site-packages/hydra/_internal/utils.py", line 458, in <lambda>
    lambda: hydra.run(
  File "/home/h/hvaidya/.conda/envs/ocl_survey/lib/python3.10/site-packages/hydra/_internal/hydra.py", line 132, in run
    _ = ret.return_value
  File "/home/h/hvaidya/.conda/envs/ocl_survey/lib/python3.10/site-packages/hydra/core/utils.py", line 260, in return_value
    raise self._return_value
  File "/home/h/hvaidya/.conda/envs/ocl_survey/lib/python3.10/site-packages/hydra/core/utils.py", line 186, in run_job
    ret.return_value = task_function(task_cfg)
  File "/data/hvaidya/ocl_survey/experiments/main.py", line 81, in main
    strategy = method_factory.create_strategy(
  File "/data/hvaidya/ocl_survey/src/factories/method_factory.py", line 295, in create_strategy
    cl_strategy = globals()[strategy](**strategy_dict, plugins=plugins)
  File "/data/hvaidya/ocl_survey/src/strategies/erace.py", line 108, in __init__
    super().__init__(
  File "/home/h/hvaidya/.conda/envs/ocl_survey/lib/python3.10/site-packages/avalanche/training/templates/common_templates.py", line 122, in __init__
    super().__init__()  # type: ignore
  File "/home/h/hvaidya/.conda/envs/ocl_survey/lib/python3.10/site-packages/avalanche/training/templates/observation_type/batch_observation.py", line 16, in __init__
    super().__init__()
TypeError: BaseSGDTemplate.__init__() missing 2 required positional arguments: 'model' and 'optimizer'

Could you please help me resolve this?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.