-
Notifications
You must be signed in to change notification settings - Fork 19.5k
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
Move Defaults to
to end of arg docstring and standardise values
#17748
Conversation
There was a problem hiding this 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. Since this is quite large at the moment, is it possible to split this into smaller ones (one PR per package), so that we can speed up the review (sending to multiple team member.)?
@qlzh727 I can, in the past I had a script to turn one PR into one per file and that got through all the hoops until they reached TensorFlow master. So you want me to do that here? - Happy to. - Maybe I'll link back here in case others want to chime in about repository-wide standards? - Also if any dis/agreements of this approach were to be made, maybe make them on this issue #17748 EDIT: Here's my script, was hitting GraphQL rate limits so added a # Setup branch, commit, push up branch
while read -r name; do (
branch="${name//\//.}"; branch="${branch::-3}-defaults-to";
git checkout master && \
git checkout -b "${branch}" && \
git checkout defaults-to "$name" && \
git commit -S -m '['"${name}"'] Standardise docstring usage of "Defaults to"' && \
git push --set-upstream mine "$branch";
) done< <(git diff --name-only)
# Send PRs after `git diff --name-only > /tmp/names` on soft-reset `defaults-to` branch
while read -r name; do
branch="${name//\//.}"; branch="${branch::-3}-defaults-to";
git checkout "$branch" && \
gh pr create \
--title '['"${name}"'] Standardise docstring usage of "Default to"' \
--body 'This is one of many PRs. Discussion + request to split into multiple PRs @ #17748' ;
sleep 5m ; # was doing `sleep 1h` before
done< <(cat /tmp/names) |
…fault to" Imported from GitHub PR #17973 This is one of many PRs. Discussion + request to split into multiple PRs @ #17748 Copybara import of the project: -- b43b215 by Samuel Marks <[email protected]>: [keras/mixed_precision/loss_scale_optimizer.py] Standardise docstring usage of "Default to" -- 19dcdeb by Samuel Marks <[email protected]>: [keras/mixed_precision/loss_scale_optimizer.py] Docstring minor improvements Merging this change closes #17973 FUTURE_COPYBARA_INTEGRATE_REVIEW=#17973 from SamuelMarks:keras.mixed_precision-defaults-to 19dcdeb PiperOrigin-RevId: 529706785
Imported from GitHub PR #17974 This is one of many PRs. Discussion + request to split into multiple PRs @ #17748 Copybara import of the project: -- b96f2bc by Samuel Marks <[email protected]>: [keras/models/cloning.py,keras/models/sharpness_aware_minimization.py] Standardise docstring usage of "Default to" -- 5719f7b by Samuel Marks <[email protected]>: [keras/models/sharpness_aware_minimization.py] Use backticks for defaults in docstrings Merging this change closes #17974 FUTURE_COPYBARA_INTEGRATE_REVIEW=#17974 from SamuelMarks:keras.models-defaults-to 5719f7b PiperOrigin-RevId: 529706730
…ult to" Imported from GitHub PR #17979 This is one of many PRs. Discussion + request to split into multiple PRs @ #17748 Copybara import of the project: -- 5c24834 by Samuel Marks <[email protected]>: [keras/testing_infra/test_combinations.py,keras/testing_infra/test_utils.py] Standardise docstring usage of "Default to" Merging this change closes #17979 FUTURE_COPYBARA_INTEGRATE_REVIEW=#17979 from SamuelMarks:keras.testing_infra-defaults-to 5c24834 PiperOrigin-RevId: 530509950
…ault to" Imported from GitHub PR #17958 This is one of many PRs. Discussion + request to split into multiple PRs @ #17748 Copybara import of the project: -- c7157c0 by Samuel Marks <[email protected]>: [keras/feature_column/dense_features.py,keras/feature_column/sequence_feature_column.py] Standardise docstring usage of "Default to" Merging this change closes #17958 FUTURE_COPYBARA_INTEGRATE_REVIEW=#17958 from SamuelMarks:keras.feature_column-defaults-to c7157c0 PiperOrigin-RevId: 530510337
Imported from GitHub PR #17956 This is one of many PRs. Discussion + request to split into multiple PRs @ #17748 Copybara import of the project: -- 9ad7371 by Samuel Marks <[email protected]>: [keras/engine/base_layer.py,keras/engine/base_layer_utils.py,keras/engine/base_layer_v1.py,keras/engine/base_preprocessing_layer.py,keras/engine/data_adapter.py,keras/engine/functional.py,keras/engine/input_layer.py,keras/engine/training.py,keras/engine/training_v1.py] Standardise docstring usage of "Default to" Merging this change closes #17956 FUTURE_COPYBARA_INTEGRATE_REVIEW=#17956 from SamuelMarks:keras.engine-defaults-to 9ad7371 PiperOrigin-RevId: 530510437
Imported from GitHub PR #17956 This is one of many PRs. Discussion + request to split into multiple PRs @ #17748 Copybara import of the project: -- 9ad7371 by Samuel Marks <[email protected]>: [keras/engine/base_layer.py,keras/engine/base_layer_utils.py,keras/engine/base_layer_v1.py,keras/engine/base_preprocessing_layer.py,keras/engine/data_adapter.py,keras/engine/functional.py,keras/engine/input_layer.py,keras/engine/training.py,keras/engine/training_v1.py] Standardise docstring usage of "Default to" Merging this change closes #17956 FUTURE_COPYBARA_INTEGRATE_REVIEW=#17956 from SamuelMarks:keras.engine-defaults-to 9ad7371 PiperOrigin-RevId: 530510437
…ult to" Imported from GitHub PR #17979 This is one of many PRs. Discussion + request to split into multiple PRs @ #17748 Copybara import of the project: -- 5c24834 by Samuel Marks <[email protected]>: [keras/testing_infra/test_combinations.py,keras/testing_infra/test_utils.py] Standardise docstring usage of "Default to" Merging this change closes #17979 FUTURE_COPYBARA_INTEGRATE_REVIEW=#17979 from SamuelMarks:keras.testing_infra-defaults-to 5c24834 PiperOrigin-RevId: 530509950
…ult to" Imported from GitHub PR #17977 This is one of many PRs. Discussion + request to split into multiple PRs @ #17748 Copybara import of the project: -- d7486bf by Samuel Marks <[email protected]>: [keras/preprocessing/image.py,keras/preprocessing/text.py] Standardise docstring usage of "Default to" -- af5d96a by Samuel Marks <[email protected]>: [keras/preprocessing/text.py] Docstring grammar improvements -- 44c0b83 by Samuel Marks <[email protected]>: [keras/preprocessing/image.py] Consistent indent of 2 for `flow_from_directory` docstring ; `flow_from_directory` defaults-to in docstring Merging this change closes #17977 FUTURE_COPYBARA_INTEGRATE_REVIEW=#17977 from SamuelMarks:keras.preprocessing-defaults-to 44c0b83 PiperOrigin-RevId: 530503462
…lt to" Imported from GitHub PR #17954 This is one of many PRs. Discussion + request to split into multiple PRs @ #17748 Copybara import of the project: -- f4445f1 by Samuel Marks <[email protected]>: [keras/applications/convnext.py,keras/applications/efficientnet.py,keras/applications/efficientnet_v2.py,keras/applications/imagenet_utils.py,keras/applications/inception_v3.py,keras/applications/mobilenet.py,keras/applications/mobilenet_v3.py,keras/applications/regnet.py,keras/applications/resnet_rs.py] Standardise docstring usage of "Default to" -- 5879670 by Samuel Marks <[email protected]>: [keras/applications] Remove as these docstrings aren't interpolated Merging this change closes #17954 FUTURE_COPYBARA_INTEGRATE_REVIEW=#17954 from SamuelMarks:keras.applications-defaults-to 5879670 PiperOrigin-RevId: 535286449
Imported from GitHub PR #17957 This is one of many PRs. Discussion + request to split into multiple PRs @ #17748 Copybara import of the project: -- 037fc4a by Samuel Marks <[email protected]>: [keras/estimator/__init__.py] Standardise docstring usage of "Default to" Merging this change closes #17957 FUTURE_COPYBARA_INTEGRATE_REVIEW=#17957 from SamuelMarks:keras.estimator-defaults-to 037fc4a PiperOrigin-RevId: 535275444
Imported from GitHub PR #17953 This is one of many PRs. Discussion + request to split into multiple PRs @ #17748 Copybara import of the project: -- 6893bd5 by Samuel Marks <[email protected]>: [keras/utils/audio_dataset.py,keras/utils/conv_utils.py,keras/utils/data_utils.py,keras/utils/dataset_utils.py,keras/utils/feature_space.py,keras/utils/generic_utils.py,keras/utils/image_dataset.py,keras/utils/image_utils.py,keras/utils/layer_utils.py,keras/utils/losses_utils.py,keras/utils/metrics_utils.py,keras/utils/text_dataset.py] Standardise docstring usage of "Default to" Merging this change closes #17953 FUTURE_COPYBARA_INTEGRATE_REVIEW=#17953 from SamuelMarks:keras.utils-defaults-to 4cbcdf8 PiperOrigin-RevId: 535277920
…ault to" Imported from GitHub PR #17966 This is one of many PRs. Discussion + request to split into multiple PRs @ #17748 Copybara import of the project: -- 60043ea by Samuel Marks <[email protected]>: [keras/layers/pooling/average_pooling2d.py,keras/layers/pooling/average_pooling3d.py,keras/layers/pooling/global_average_pooling2d.py,keras/layers/pooling/global_average_pooling3d.py,keras/layers/pooling/global_max_pooling2d.py,keras/layers/pooling/global_max_pooling3d.py,keras/layers/pooling/max_pooling2d.py,keras/layers/pooling/max_pooling3d.py] Standardise docstring usage of "Default to" Merging this change closes #17966 FUTURE_COPYBARA_INTEGRATE_REVIEW=#17966 from SamuelMarks:keras.layers.pooling-defaults-to 60043ea PiperOrigin-RevId: 536547948
…efault to" Imported from GitHub PR #17971 This is one of many PRs. Discussion + request to split into multiple PRs @ #17748 Copybara import of the project: -- 5331dac by Samuel Marks <[email protected]>: [keras/legacy_tf_layers/base.py,keras/legacy_tf_layers/migration_utils.py,keras/legacy_tf_layers/variable_scope_shim.py] Standardise docstring usage of "Default to" -- 1801651 by Samuel Marks <[email protected]>: [keras/legacy_tf_layers/migration_utils.py] Move docstring from method to class and document `seed` Merging this change closes #17971 FUTURE_COPYBARA_INTEGRATE_REVIEW=#17971 from SamuelMarks:keras.legacy_tf_layers-defaults-to 1801651 PiperOrigin-RevId: 535274600
…f "Default to" Imported from GitHub PR #17963 This is one of many PRs. Discussion + request to split into multiple PRs @ #17748 Copybara import of the project: -- c7bcf63 by Samuel Marks <[email protected]>: [keras/layers/convolutional/base_depthwise_conv.py,keras/layers/convolutional/conv1d_transpose.py,keras/layers/convolutional/conv2d.py,keras/layers/convolutional/conv2d_transpose.py,keras/layers/convolutional/conv3d.py,keras/layers/convolutional/conv3d_transpose.py,keras/layers/convolutional/depthwise_conv1d.py,keras/layers/convolutional/depthwise_conv2d.py,keras/layers/convolutional/separable_conv2d.py] Standardise docstring usage of "Default to" Merging this change closes #17963 FUTURE_COPYBARA_INTEGRATE_REVIEW=#17963 from SamuelMarks:keras.layers.convolutional-defaults-to c7bcf63 PiperOrigin-RevId: 535275433
Imported from GitHub PR #17956 This is one of many PRs. Discussion + request to split into multiple PRs @ #17748 Copybara import of the project: -- 9ad7371 by Samuel Marks <[email protected]>: [keras/engine/base_layer.py,keras/engine/base_layer_utils.py,keras/engine/base_layer_v1.py,keras/engine/base_preprocessing_layer.py,keras/engine/data_adapter.py,keras/engine/functional.py,keras/engine/input_layer.py,keras/engine/training.py,keras/engine/training_v1.py] Standardise docstring usage of "Default to" Merging this change closes #17956 FUTURE_COPYBARA_INTEGRATE_REVIEW=#17956 from SamuelMarks:keras.engine-defaults-to 9ad7371 PiperOrigin-RevId: 536547635
…ault to" Imported from GitHub PR #17958 This is one of many PRs. Discussion + request to split into multiple PRs @ #17748 Copybara import of the project: -- c7157c0 by Samuel Marks <[email protected]>: [keras/feature_column/dense_features.py,keras/feature_column/sequence_feature_column.py] Standardise docstring usage of "Default to" Merging this change closes #17958 FUTURE_COPYBARA_INTEGRATE_REVIEW=#17958 from SamuelMarks:keras.feature_column-defaults-to c7157c0 PiperOrigin-RevId: 535275621
I've written a Python compiler that can do a bunch of thing. Relevant to Keras I am turning TensorFlow into SQL tables by way of SQLalchemy:
After deduplicating and running
black
here are the contents ofsgd.py
:As you can see,
momentum
has an incorrect value because of how you've written your docstrings:https://github.com/keras-team/keras/blob/0f8e81f/keras/optimizers/sgd.py#L62
Some commentary on the
Defaults to
syntax as understood by Sphinx:So this PR rewrite your docstrings to put the
Defaults to
at the end and limit it to one value or a boolean condition.PS: I also noticed inconsistent use of backticks. Did you want them everywhere? - This would disambiguate floats from integers I guess