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 type hints for dropout, dropout parameter references, and add docs for FCLayer and FCStack. #2061

Merged
merged 3 commits into from
Jun 3, 2022

Conversation

justinxzhao
Copy link
Collaborator

No description provided.

@github-actions
Copy link

github-actions bot commented May 26, 2022

Unit Test Results

       6 files  ±0         6 suites  ±0   2h 24m 31s ⏱️ -41s
2 802 tests +2  2 770 ✔️ +2    32 💤 ±0  0 ±0 
8 406 runs  +6  8 306 ✔️ +6  100 💤 ±0  0 ±0 

Results for commit fc7a9c0. ± Comparison against base commit b920c86.

♻️ This comment has been updated with latest results.

@w4nderlust
Copy link
Collaborator

It's not super clear to me why in some cases we are renaming parameters from dropout to recurrent dropout and in some cases we are dropping them altogether (no pun intended). Can you give a bit more context @justinxzhao ?

@justinxzhao
Copy link
Collaborator Author

It's not super clear to me why in some cases we are renaming parameters from dropout to recurrent dropout and in some cases we are dropping them altogether (no pun intended). Can you give a bit more context @justinxzhao ?

The changes in this PR is mainly to make the use of separate dropout parameters, where there are already multiple dropout parameters in the constructor, consistent across all Ludwig modules. New consistency in this PR:

  • H3RNN:
    • dropout -> H3Embed
    • recurrent_dropout -> RecurrentStack
  • StackedRNN:
    • dropout -> EmbedSequence
    • recurrent_dropout -> RecurrentStack
    • fc_dropout -> FCStack
  • StackedCNNRNN:
    • dropout -> EmbedSequence
    • conv_dropout -> Conv1DStack
    • recurrent_dropout -> RecurrentStack
    • fc_dropout -> FCStack

As for removing recurrent_dropout=... -- the constructor of RecurrentStack doesn't actually have a kwarg for recurrent_dropout. It's simply called dropout=....

On a side note, I wonder if it's reasonable to simplify/consolidate all of the different dropout parameters into a more global dropout parameter that we can use for everything. Curious to get people's thoughts @w4nderlust @dantreiman @geoffreyangus @ShreyaR

@w4nderlust
Copy link
Collaborator

@justinxzhao got it, make sense.
Although it seems to me that StackedCNNRNN has a couple issues.
it doesn't have type hints, the order where the dropout parameter is placed is wrong (it should be close to the embedding parameter at the beginning), in some cases the default value for dropouts is 0, in others it is 0.0 (not a big issue, but consistency is great), and finally in the recurrent stack we have dropout=dropout, but it should be dropout=recurrent_dropout.

A side note: in all these cases, dropout is the one used in embeddings, while other modules have their own. It could be better to rename it to embedding_dropout or embed_dropout for clarity and consistency potentially. What do you think?

@justinxzhao justinxzhao added this to In progress in Ludwig Documentation May 26, 2022
@justinxzhao justinxzhao moved this from In progress to Done in Ludwig Documentation May 26, 2022
@justinxzhao justinxzhao moved this from Done to In progress in Ludwig Documentation May 26, 2022
@justinxzhao justinxzhao removed this from In progress in Ludwig Documentation May 26, 2022
@justinxzhao justinxzhao added this to To do in Code Quality May 26, 2022
@justinxzhao justinxzhao moved this from To do to In progress in Code Quality May 26, 2022
@justinxzhao
Copy link
Collaborator Author

I'll defer to #1924 to add type hints everywhere.

Perhaps once we have schemas checked-in, we can use them to automatically generate docstrings from them and do a grand substitution/update everywhere.

Fixed dropout=recurrent_dropout in the StackedCNNRNN.

A side note: in all these cases, dropout is the one used in embeddings, while other modules have their own. It could be better to rename it to embedding_dropout or embed_dropout for clarity and consistency potentially. What do you think?

I'll leave it as dropout for now, to ensure backwards compatibility.

I'm beginning to lean towards consolidating all of the per-module dropout parameters into a single parameter (filed #2080 to track) unless we see strong evidence that dramatically different dropouts results in significantly performance gains. Perhaps we can continue the discussion on that issue, and make that change later.

Copy link
Collaborator

@geoffreyangus geoffreyangus left a comment

Choose a reason for hiding this comment

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

LGTM! Left a comment re: dropout here: #2080

@justinxzhao justinxzhao merged commit e43053a into master Jun 3, 2022
@justinxzhao justinxzhao deleted the type_hint_fixes branch June 3, 2022 17:59
Code Quality automation moved this from In progress to Done Jun 3, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Development

Successfully merging this pull request may close these issues.

None yet

3 participants