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

Some minor fixes in batch_observation and utils #1513

Merged
merged 4 commits into from Oct 10, 2023

Conversation

AlbinSou
Copy link
Collaborator

@AlbinSou AlbinSou commented Oct 9, 2023

Two fixes,

One is some useless code that was left in the batch_observation. This code was slowing down a bit in the case of using an online setting with access to task boundaries. I had mistakenly left this part of code when switching to using util function at_task_boundary.

Another is about some formatting and changing one feature in the at_task_boundary function. So far the function was only using is_first_subexp attribute which was leading to some problems when using it in after_training_task, it was not detecting the boundary if the experience was the last experience of the task. Now it is detecting the boundary both right before the shift and right after the shift.

@coveralls
Copy link

coveralls commented Oct 9, 2023

Pull Request Test Coverage Report for Build 6469661204

  • 12 of 12 (100.0%) changed or added relevant lines in 2 files are covered.
  • 1 unchanged line in 1 file lost coverage.
  • Overall coverage decreased (-0.004%) to 72.5%

Files with Coverage Reduction New Missed Lines %
avalanche/training/utils.py 1 93.43%
Totals Coverage Status
Change from base Build 6299610004: -0.004%
Covered Lines: 17566
Relevant Lines: 24229

💛 - Coveralls

if (
training_experience.is_first_subexp
or training_experience.is_last_subexp
):
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you explain this again? I'm a bit confused. With the current condition, we are going to update model and optimizer twice, at the final experience and at the new one.

Copy link
Collaborator Author

@AlbinSou AlbinSou Oct 10, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, that's right, nice catch. The idea is that this util function should be able to return both sides of the boundary. Maybe I should add an option to say which side to detect ?

For instance, I had the problem recently that to implement LwF for a compatibility with online, I also need to use this function but in the after_training_exp, so I need to know the right side of the boundary, whereas when it is called in before_training_exp I need to know the left side of the boundary.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, but make it private (_at_task_boundary(before=True)). It's ok as an internal utility but I think it would be a bit confusing for external users

@AntonioCarta
Copy link
Collaborator

if you fix the lint error I can merge this.

@AntonioCarta AntonioCarta merged commit 0515a47 into ContinualAI:master Oct 10, 2023
18 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants