Skip to content
This repository was archived by the owner on Mar 10, 2026. It is now read-only.

Move Defaults to to end of arg docstring and standardise values#1848

Open
SamuelMarks wants to merge 15 commits intokeras-team:masterfrom
SamuelMarks:defaults-to
Open

Move Defaults to to end of arg docstring and standardise values#1848
SamuelMarks wants to merge 15 commits intokeras-team:masterfrom
SamuelMarks:defaults-to

Conversation

@SamuelMarks
Copy link
Contributor

What does this PR do?

Hey it's that annoying fellow again, the one from keras-team/keras#17748

Before submitting

  • This PR fixes a typo or improves the docs (you can dismiss the other checks if that's the case).

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.

Copy link
Contributor

@ianstenbit ianstenbit 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 the PR!

I chatted with the team and I think we're generally happy about this change -- thanks for the diligence here! I left one comment about structure, and then I'll dig through every little change once you've updated that 😄

# Conflicts:
#	keras_cv/models/backbones/mobilenet_v3/mobilenet_v3_backbone.py
#	keras_cv/models/backbones/resnet_v1/resnet_v1_backbone.py
…resnet_v1_backbone.py] Resolve conflicts ; [keras_cv/models/backbones/resnet_v1/resnet_v1_{aliases,backbone}.py] Re-apply defaults-to after merge of master
@SamuelMarks
Copy link
Contributor Author

3 weeks has gone by, @ianstenbit did you need me to merge master and redo this?

Copy link
Contributor

@ianstenbit ianstenbit left a comment

Choose a reason for hiding this comment

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

Reviewed up through layers/preprocessing. I think may of the comments are repeats that will apply through the rest of the PR.

My apologies for the latency on this -- it's been a very busy few weeks and PR review has been slower.

"""

# Try to detect an available TPU. If none is present, defaults to
# Try to detect an available TPU. If none is present. Defaults to
Copy link
Contributor

Choose a reason for hiding this comment

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

Let's undo this change for all the comments in examples.

img_size: the size to resize the images to, defaults to None, indicating
that images should not be resized.
epoch. Defaults to `False`.
img_size: the size to resize the images to, when None, this indicates
Copy link
Contributor

Choose a reason for hiding this comment

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

when None

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Makes sense to me:

the size to resize the images to, when None, this indicates that images should not be resized. Defaults to None.

Copy link
Contributor

Choose a reason for hiding this comment

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

Sorry I just meant use backticks for None. GitHub is rendering my backticks which makes these comments less clear 😓

used to download the data file, and unzip. It will be used as a
cache directory. Defaults to None, and `~/.keras/pascal_voc_2012`
will be used.
cache directory. When `None`: `~/.keras/pascal_voc_2012`
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe best to just say defaults to ~/.keras/pascal_voc_2012?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

But it doesn't default to that value? - It computes to it sure, but defaults to None.

@ianstenbit
Copy link
Contributor

3 weeks has gone by, @ianstenbit did you need me to merge master and redo this?

I think the merge conflicts shouldn't be too bad if you want to merge from master.

I left some comments on the first ~half, but it looks like there are some fixes that will need to be made through the rest as well. Thanks for the PR and my apologies for the review delay!

# Conflicts:
#	keras_cv/bounding_box/converters.py
#	keras_cv/models/backbones/csp_darknet/csp_darknet_backbone.py
#	keras_cv/models/backbones/efficientnet_v2/efficientnet_v2_backbone.py
#	keras_cv/models/backbones/resnet_v1/resnet_v1_backbone.py
#	keras_cv/models/backbones/resnet_v2/resnet_v2_backbone.py
#	keras_cv/models/legacy/densenet.py
#	keras_cv/models/legacy/segmentation/deeplab.py
@SamuelMarks
Copy link
Contributor Author

@ianstenbit Merged in latest master and applied the defaults to changes to more places. It should be ready to go now; merge quick before master deviates!

Copy link
Contributor

@ianstenbit ianstenbit left a comment

Choose a reason for hiding this comment

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

LGTM -- thank you!

Left a bunch of comments about tiny changes, but once those are in I can merge this. If you're able to make the changes today I can hold off on merging any other PRs to avoid merge conflicts.

Thanks again for the big cleanup!

image. Defaults to `target_size`.
bounding_box_format: The format of bounding boxes of input boxes.
Refer to
https://github.com/keras-team/keras-cv/blob/master/keras_cv/bounding_box/converters.py
Copy link
Contributor

Choose a reason for hiding this comment

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

why drop the github.com prefix?

Will GitHub automagically render this link for us in the UI? That would be cool

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@ianstenbit Oh actually I think it was flake8 picking up a long line

@SamuelMarks
Copy link
Contributor Author

@ianstenbit Done

@ianstenbit
Copy link
Contributor

@ianstenbit Done

It looks like MobileNet tests are failing -- I'd recommend reverting the change in the MobileNet backbone and merging from master

@SamuelMarks
Copy link
Contributor Author

@ianstenbit I'm confused, what is it you want me to do?

git checkout master
git pull origin master # origin is keras-team/keras-cv
git checkout defaults-to
git merge master
git checkout master keras_cv/models/backbones/mobilenet_v3/mobilenet_v3_backbone_test.py
git checkout master keras_cv/models/backbones/mobilenet_v3/mobilenet_v3_aliases.py
git commit -S -a

@ianstenbit
Copy link
Contributor

Merge branch 'master' into defaults-to

yeah that seems correct. Not clear what is causing this test failure, but I'd try reverting the changes to MobileNet (See my other comment)

@SamuelMarks
Copy link
Contributor Author

Weird, isn't that what my checkout commands do? - Maybe it's another file causing the issue?

@ianstenbit
Copy link
Contributor

Weird, isn't that what my checkout commands do? - Maybe it's another file causing the issue?

It could be another file. But checkout doesn't revert the changes that you've already committed, only staged / uncommitted changes by default

# Conflicts:
#	keras_cv/models/legacy/efficientnet_lite.py
#	keras_cv/models/legacy/efficientnet_v1.py
# Conflicts:
#	keras_cv/models/legacy/efficientnet_lite.py
#	keras_cv/models/legacy/efficientnet_v1.py
@SamuelMarks
Copy link
Contributor Author

@ianstenbit Ok I've merged in master again. If you like, I can split this PR up into many small ones.

@ianstenbit
Copy link
Contributor

@ianstenbit Ok I've merged in master again. If you like, I can split this PR up into many small ones.

It looks like the CI is still failing -- I think it's probably still the MobileNet issue from before but please take a look. Thanks!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants