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

Hparams: Add include_in_result field and implement support for hparams_to_include #6559

Merged
merged 4 commits into from
Sep 8, 2023

Conversation

yatbear
Copy link
Member

@yatbear yatbear commented Aug 25, 2023

This PR extracts the filtering logic for hparams only (metrics filtering will be done later) from bmd3k's commit.

Googlers, see comments in cl/559852837 for more context.

Test internally at cl/563163418.

#hparams

if all(
not col_param.HasField("include_in_result") for col_param in col_params
):
return None
Copy link
Contributor

Choose a reason for hiding this comment

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

This pattern of calling a "get" method then returning None to indicate that all should be included is quite confusing. Can we just return all the params? That should reduce amount of places the code needs to care about this and minimize the number of logical branches.

Suggested change
return None
return [col_param.hparam for col_param in col_params]

I would also be okay with renaming the function, or returning something more meaningful than None.

Copy link
Member Author

@yatbear yatbear Aug 25, 2023

Choose a reason for hiding this comment

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

Thanks for the super fast review! This is a good point, my only concern is if there are a large number of Hparams, then we will be passing all of them to the backend and not sure if it will worsen the performance, I'll see if I could do some testing internally later.

Copy link
Member Author

Choose a reason for hiding this comment

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

@rileyajones I added @bmd3k's helper method _specifies_include() (bmd3k@ab75cd1) so that the get method is cleaner but we can still do a quick check to avoid sending all the hparams when no include field is specified.

Copy link
Member Author

Choose a reason for hiding this comment

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

The internal tests are not passing, will fix this PR and let you know once it's ready.

Copy link
Member Author

Choose a reason for hiding this comment

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

Actually tests passed after removing other changes outside this PR (cl/563163418).

@yatbear yatbear changed the title Add include_in_result field and implement support for hparams_to_include. Hparams: Add include_in_result field and implement support for hparams_to_include Sep 6, 2023
@yatbear yatbear requested a review from rileyajones September 6, 2023 19:32
Copy link
Contributor

@rileyajones rileyajones left a comment

Choose a reason for hiding this comment

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

Thanks Yating!

@yatbear yatbear merged commit 34bfbd9 into tensorflow:master Sep 8, 2023
13 checks passed
@yatbear yatbear deleted the hparams branch September 8, 2023 15:28
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.

3 participants