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

Let drop_last modify gather_for_metrics #2048

Merged
merged 5 commits into from
Oct 12, 2023
Merged

Let drop_last modify gather_for_metrics #2048

merged 5 commits into from
Oct 12, 2023

Conversation

muellerzr
Copy link
Collaborator

What does this PR do?

Ensures that if drop_last=True, the default remainder for the GradientState is utilized since we are just dropping the non-fitting batch anyways instead.

Fixes # (issue)

closes #2007

Before submitting

  • This PR fixes a typo or improves the docs (you can dismiss the other checks if that's the case).
  • Did you read the contributor guideline,
    Pull Request section?
  • Was this discussed/approved via a Github issue or the forum? Please add a link
    to it if that's the case.
  • Did you make sure to update the documentation with your changes? Here are the
    documentation guidelines, and
    here are tips on formatting docstrings.
  • Did you write any new necessary tests?

Who can review?

Anyone in the community is free to review the PR once the tests have passed. Feel free to tag
members/contributors who may be interested in your PR.

@BenjaminBossan @LysandreJik

@HuggingFaceDocBuilderDev
Copy link

HuggingFaceDocBuilderDev commented Oct 11, 2023

The documentation is not available anymore as the PR was closed or merged.

Copy link
Member

@BenjaminBossan BenjaminBossan left a comment

Choose a reason for hiding this comment

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

Thanks for fixing the bug. Only some nits, feel free to ignore.

rng_types=None,
synchronized_generator=None,
skip_batches=0,
_drop_last: bool = False,
Copy link
Member

Choose a reason for hiding this comment

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

Why use an underscore for the argument name? That's quite unusual. drop_last on the dataloader doesn't use an underscore. If the attribute should be marked as "private", it can still use an underscore, but for the argument name, I'd go without (i.e. self._drop_last = drop_last).

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Because it is indeed private, and to be consistent with the other dataloader arg which has it as private too. Because we control it, the user shouldn't ever pass in _drop_last (but we need to on the backend)

Copy link
Member

Choose a reason for hiding this comment

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

I see. It's a bit strange to the eye, but as you said, it should not be visible to the user.

rng_types=None,
synchronized_generator=None,
skip_batches=0,
_drop_last: bool = False,
Copy link
Member

Choose a reason for hiding this comment

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

I see. It's a bit strange to the eye, but as you said, it should not be visible to the user.

@muellerzr muellerzr merged commit 50acb0c into main Oct 12, 2023
24 checks passed
@muellerzr muellerzr deleted the drop_last branch October 12, 2023 18:27
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.

gather_for_metrics does not respect dataloader drop_last=True setting
3 participants