New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Possible Replay bug #543
Comments
If I understand correctly the bug happens only whenever |
Thanks @Mattdl for reporting, if you have already a general fix in place, would you be able to tackle this opening a PR? thanks :) |
Yes sure, I'll add the fix as soon as possible! (: |
A single PR is ok. |
I'm finishing up on the PR, but one issue remains if you want to update the replay memory in each minibatch. I tried the following in the
This works for a while, but eventually gives a |
Maybe you can try replace the dataset inside the data loader object "manually" and reset its state instead of creating a new data loader? Just guessing. Maybe @AntonioCarta and @lrzpellegrini have better insights. |
Why do you need to update the buffer during training? I don't think this is needed if your benchmark is set up correctly. Basically, whenever you receive new data (a new experience), you update the replay buffer and you're done. If I understand what you want to do, you are assuming a scenario where data (an experience) arrives in mini-batches. I think the best way to model this setting is to split your stream accordingly before calling Regarding the error, I may be wrong but it could be related to the implementation of |
@AntonioCarta I'm trying to make a solution that's also applicable for online data incremental learning, therefore we need to update the buffer during training as the data comes in. We already had some discussion on this in #360, but it seems to me a first solution with no drastic changes to the codebase is:
The next step would be to have some kind of meta-experiences (e.g. tasks/domains) to define the scenarios, and then the experiences (batches) for processing. I see it as something like I've implemented a first example with CoPE, but I first need to figure out how to fix this issue. From there on it can be expanded to other online methods. |
The problem I see with your current implementation is that the end-user is not aware that the scenario is data incremental. In Avalanche we separate data streams and strategies, therefore it make sense to me to prepare the mini-batches for a data incremental scenario outside the strategy. Think about this problem. How do you compare other strategies with CoPE on the same scenario? With your solution it's much more difficult to understand if each strategy is training on the same experiences, because CoPE de facto splits the experience into multiple smaller experiences. I need to be aware of its internal implementation.
This seems the main roadblock that you have right now and the reason why you chose the current solution. I think it's easy to add a
Unfortunately I don't think you will solve any problems with this, it doesn't look any different from what you're doing right now.
I have a vague idea but I'm not sure how to solve it. @lrzpellegrini can you help on this? Is it possible to improve |
I completely agree! I was trying a tentative intermediate solution, but the generator idea you proposed would be ideal:
I'll implement CoPE as an experience-based algorithm in this PR and change the according example later in another PR, when the solutions for the |
Hi @Mattdl I'm trying to reproduce the error with the |
Hi @lrzpellegrini, great! I've opened the PR (see above), you can use the example in examples/copy.py.
|
Thank you @Mattdl, I'll try this immediately! |
I'm encountering a different error in self.max_len = max([len(d) for d in self.dataloaders.values()]) |
Oh yeah probably because of this.
|
@lrzpellegrini let me know if we can close it since the original issue has been solved. Maybe you want to open a new issue for the improved concat? |
Yes, I was able to reproduce the issue. I'm doing some debugging to identify the cause (probably a ConcatDataset annidation). I'll open another issue soon. |
Hi all,
I'm working on implementing Class-Balanced and Experience-balanced Replay (See #479).
I want to provide the opportunity for the user to select a fixed capacity prior or adaptive to all seen experiences so far.
However, when looking at the Replay code I find it hard to follow:
In the first line:
avalanche/avalanche/training/plugins/replay.py
Line 64 in 9cf3c53
What if len(curr_data) is smaller than self.mem_size? It would occur to me that 'h' is not correct anymore. Even though the current data length
len(curr_data)
may not equal the full memory size, it can still have capacity for amem_size/n_observed_exps
portion of the memory.So
h
should becomeself.mem_size // (strategy.training_exp_counter + 1)
?When taking the random_split however, then we should take the 'min' operation into account:
Am I missing something here or is this a bug?
The text was updated successfully, but these errors were encountered: