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

[WIP] Stricter argument hygiene for passing datamodules to trainer.fit or t… #7329

Closed
wants to merge 5 commits into from

Conversation

ananthsub
Copy link
Contributor

@ananthsub ananthsub commented May 3, 2021

What does this PR do?

  • Deprecates passing datamodules as an unnamed argument to trainer.fit and trainer.tune
  • Provides consistency with how datamodules are passed to validate and test
  • Allows stronger typing for train_dataloader in these APIs

Before submitting

  • Was this discussed/approved via a GitHub issue? (not for typos and docs)
  • Did you read the contributor guideline, Pull Request section?
  • Did you make sure your PR does only one thing, instead of bundling different changes together?
  • Did you make sure to update the documentation with your changes? (if necessary)
  • Did you write any new necessary tests? (not for typos and docs)
  • Did you verify new and existing tests pass locally with your changes?
  • Did you update the CHANGELOG? (not for typos, docs, test updates, or internal minor changes/refactorings)

PR review

Anyone in the community is free to review the PR once the tests have passed.
Before you start reviewing make sure you have read Review guidelines. In short, see the following bullet-list:

  • Is this pull request ready for review? (if not, please submit in draft mode)
  • Check that all items from Before submitting are resolved
  • Make sure the title is self-explanatory and the description concisely explains the PR
  • Add labels and milestones (and optionally projects) to the PR so it can be classified

Did you have fun?

Make sure you had fun coding 🙃

@pep8speaks
Copy link

pep8speaks commented May 3, 2021

Hello @ananthsub! Thanks for updating this PR.

There are currently no PEP 8 issues detected in this Pull Request. Cheers! 🍻

Comment last updated at 2021-05-04 06:44:45 UTC

@ananthsub ananthsub added this to the v1.3 milestone May 3, 2021
@codecov
Copy link

codecov bot commented May 3, 2021

Codecov Report

Merging #7329 (4ed2254) into master (597b309) will increase coverage by 0%.
The diff coverage is 100%.

@@          Coverage Diff           @@
##           master   #7329   +/-   ##
======================================
  Coverage      87%     87%           
======================================
  Files         200     200           
  Lines       12896   12899    +3     
======================================
+ Hits        11204   11231   +27     
+ Misses       1692    1668   -24     

@carmocca
Copy link
Contributor

carmocca commented May 3, 2021

I actually have a WIP (waiting for 1.4) branch to do exactly the opposite - adding the positional datamodule for the other functions.

This is a very widely used pattern:

trainer.fit(model, dm)

I'm not sure stronger typing is enough reason to remove it.

This was also asked by @awaelchli here: #7258 (comment)

@ananthsub ananthsub modified the milestones: v1.3, v1.4 May 3, 2021
@mergify mergify bot added the has conflicts label May 4, 2021
Copy link
Member

@Borda Borda left a comment

Choose a reason for hiding this comment

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

nice :]

@Borda Borda added the ready PRs ready to be merged label May 4, 2021
@mergify mergify bot removed the has conflicts label May 4, 2021
@Borda
Copy link
Member

Borda commented May 4, 2021

@ananthsub @carmocca just thinking if we shall define this kind of collection of messages which are repetitive in multiple places on the codebase and use them as constant?

Copy link
Contributor

@tchaton tchaton left a comment

Choose a reason for hiding this comment

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

LGTM ! Thanks for this.

@tchaton tchaton changed the title Stricter argument hygiene for passing datamodules to trainer.fit or t… [WIP] Stricter argument hygiene for passing datamodules to trainer.fit or t… May 4, 2021
Copy link
Contributor

@s-rog s-rog left a comment

Choose a reason for hiding this comment

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

WIP or ready to go? 😅
Either way, LGTM!

@tchaton tchaton self-requested a review May 4, 2021 08:35
Copy link
Contributor

@tchaton tchaton left a comment

Choose a reason for hiding this comment

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

Waiting on Carlos resolution. I agree it is a common use-case and will frustrate users.

@awaelchli
Copy link
Contributor

Not sure about this change. I understand the motivation but I don't think it is necessary. When the user will upgrade from 1.2 to 1.3, they will already see plenty of deprecation messages and this one here seems unnecessary. I vote for holding back on this.

@mergify mergify bot added the has conflicts label May 4, 2021
@ananthsub ananthsub removed the ready PRs ready to be merged label May 4, 2021
@awaelchli
Copy link
Contributor

awaelchli commented May 7, 2021

Do we go with #7431 or vote for one of them?

@carmocca
Copy link
Contributor

IMO this is a no-go considering it's too ingrained into user's brains

@awaelchli
Copy link
Contributor

What's the verdict on this one? 😅 we have accepts and we have some arguments against. A vote with core?

@carmocca carmocca removed this from the v1.4 milestone Jul 7, 2021
@carmocca carmocca marked this pull request as draft August 11, 2021 21:38
@carmocca carmocca closed this Aug 25, 2021
@tchaton
Copy link
Contributor

tchaton commented Aug 26, 2021

Yes, validate Carlos call there. This is too much of a common usage to be dropped.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants