avalanche-rl icon indicating copy to clipboard operation
avalanche-rl copied to clipboard

'DQNStrategy' object has no attribute 'clock'

Open Ai360n opened this issue 2 years ago • 1 comments

Hello,

I am writing to inform you that there is a problem between the avalanche-rl and DQNStrategy. Unfortunately, in avalanche-rl when a strategy uses EWC plugin, below error will be raise: Error for Compute EWC penalty and add it to the loss. exp_counter = strategy.clock.train_exp_counter if exp_counter == 0: return 'DQNStrategy' object has no attribute 'clock'.

It needs to add 'clock' attribute in 'DQNStrategy'. I will appreciate if you update this bug in the avalanhe-rl.

avalanche-lib==0.3.1

Ai360n avatar Aug 12 '23 17:08 Ai360n

Hi @Ai360n, I'm having the same problem right now, but if you don't need the clock and you just need an alternative way to use the experience_counter, then just use the training_exp_counter attribute of the RLBaseStrategy class, which has the same meaning of train_exp_counter.

So inside ewc.py of avalanche just change your line to exp_counter = strategy.training_exp_counter (in both before_backward and after_training_exp methods).

Of course in order to do this you should have installed avalanche 0.3.1 locally with pip install -e . option, in order to use your local modifies as the library.

tobiapoppi avatar Aug 22 '23 11:08 tobiapoppi