Skip to content
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

fix-agem. resolved memory filling and grad proj #495

Merged
merged 2 commits into from
Jul 23, 2021
Merged

fix-agem. resolved memory filling and grad proj #495

merged 2 commits into from
Jul 23, 2021

Conversation

JonasFrey96
Copy link
Contributor

A-Gem is now working (fixed gradient projection computation) and nearly matching the reported performance.
Updated the example providing the new numbers.

Best Jonas

@AntonioCarta
Copy link
Collaborator

Thanks @JonasFrey96! your changes look good but there are some syntax errors. I will merge the code as soon as you fix them.

@ggraffieti
Copy link
Member

avalanche/training/plugins/agem.py line 61.
A comma after the asset's comparison and before the message is missing.
Fix the problem and the PR should be good to be integrated inside avalanche! 🎉

@JonasFrey96
Copy link
Contributor Author

Thanks a lot. Best Jonas

@AndreaCossu
Copy link
Collaborator

Hi @JonasFrey96 . Checks are still failing. Please, run from the avalanche root folder the command pycodestyle avalanche to make your code PEP8 compliant.
Then, move to the tests folder and run USE_GPU=false; FAST_TEST=true python -m unittest. These should show you the errors.

@EdenBelouadah
Copy link
Collaborator

If you use Pycharm, it has an auto PEP-8 corrector, it can help you to check your mistakes and reformat the file.

@ggraffieti
Copy link
Member

Thanks, @EdenBelouadah for pointing this out, the pep8 checking of the project is configured to be exactly the same as pycharm. Maybe we could have mentioned that PyCharm is the preferred editor to use in a better way (maybe in the "How to contribute" section of the documentation).

Apart from that seems that there is also an error in a test:
File "/home/runner/work/avalanche/avalanche/avalanche/training/plugins/agem.py", line 61, in after_backward assert current_gradients.shape == self.reference_gradients.shape , "Different model parameters in AGEM projection" AttributeError: 'list' object has no attribute 'shape'

To run the test locally (and not have to rely only on GitHub actions) you can use this command:
FAST_TEST=True USE_GPU=False python -m unittest

@vlomonaco
Copy link
Member

Hi @JonasFrey96, this PR has been pending for a while, do you plan to make you amendment soon? Otherwise we can take care of it. Thanks again for your help!

@AndreaCossu
Copy link
Collaborator

I'll take care of polishing this up.

@AndreaCossu AndreaCossu self-assigned this Apr 15, 2021
@AndreaCossu
Copy link
Collaborator

I've fixed the PEP8 but it seems that I cannot push directly on the fix-agem branch of @JonasFrey96 's fork. I can open a PR from my fork.

I also fixed the self.reference_gradients tensor list which was treated as a tensor, thus causing errors in .shape call. I don't know how the example has been run to update the accuracy values.
Moreover, I am not able to reproduce the performance stated in the example for SMNIST. I obtain ~30% less final average accuracy.

@vlomonaco vlomonaco marked this pull request as draft April 20, 2021 08:48
@AntonioCarta
Copy link
Collaborator

@AndreaCossu if I'm not mistaken A-GEM is tested on multi-task scenarios. Is our implementation using task labels correctly and multi-head models? Did you try the new multi-head models?

Otherwise, let me know how do you want to proceed.

@AndreaCossu AndreaCossu removed their assignment May 20, 2021
@vlomonaco vlomonaco added the Training Related to the Training module label Jun 6, 2021
@vlomonaco
Copy link
Member

@AndreaCossu @AntonioCarta how do we want to proceed on this? I don't remember what we decided.

@AndreaCossu
Copy link
Collaborator

We still have to convert A-GEM to use the multi-head models by using Avalanche custom model.

@AntonioCarta AntonioCarta mentioned this pull request Jul 23, 2021
@AntonioCarta AntonioCarta merged commit 4e3cf68 into ContinualAI:master Jul 23, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Training Related to the Training module
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants