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

Add a contributing guide #67

Merged
merged 7 commits into from
Feb 1, 2022
Merged

Add a contributing guide #67

merged 7 commits into from
Feb 1, 2022

Conversation

LukeWood
Copy link
Contributor

We can eventually move this into governance if needed.

@LukeWood
Copy link
Contributor Author

+haifeng and +matt as well - we will be reusing similar guides so it would be good to make sure I'm not missing anything here!

@bhack
Copy link
Contributor

bhack commented Jan 30, 2022

We are trying to standardize a template for this file in the ecosystem at:

tensorflow/community#384

It would be nice If you could contribute to the review and adopt it also in the Keras ecosystem

@saberkun
Copy link

Do you want to test all apis be compatible with all tf.distribute strategies? Do you want to build such testing infrastructure to help the community?

@LukeWood
Copy link
Contributor Author

Do you want to test all apis be compatible with all tf.distribute strategies?

ideally, but there may be some exceptions. Right now the COCORecall metric isn’t compatible with the TPU strategy.

@LukeWood
Copy link
Contributor Author

Do you want to test all apis be compatible with all tf.distribute strategies? Do you want to build such testing infrastructure to help the community?

What would this look like? Basically a parameterized test case where a param is test strategy? I suppose it depends on if we can emulate distribution strategies without using underlying hardware

CONTRIBUTING.md Outdated Show resolved Hide resolved
```shell
git clone https://github.com/YOUR_GITHUB_USERNAME/keras.git
cd keras
pip install ".[tests]"
Copy link
Member

Choose a reason for hiding this comment

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

what is ".[test]"? Usually we list all the required dependency in a requirements.txt file, and use pip install -r requirements.txt.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

.[tests] installs everything required to run unit tests. You can see how this is handled in KerasTuner as well:
https://github.com/keras-team/keras-tuner/blob/master/setup.py#L40

So, installing:

pip install .

will install the list on line 30. pip install .[tests] will also install pytest, flake8, isort, etc.

WDYT?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I personally am a fan of the setup.py dependency management system.

Copy link
Member

Choose a reason for hiding this comment

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

I am not sure! I don't really know enough about what is common practice in the python packaging world (or is this a legitimate source of contention?). It is nice to be able to split the testing and package requirements.

Some discussion:
https://stackoverflow.com/q/43658870
https://packaging.python.org/en/latest/discussions/install-requires-vs-requirements/

install_requires works and we have it now, so I am fine to leave as is unless we have a good reason to switch.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Some extra context: the benefit of requirements is you can pin versions.

But at Google we are forced to update all dependencies anyways, so for Keras I think install_requires is superior.

Copy link
Member

Choose a reason for hiding this comment

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

If requirements.txt makes it easier to pin a system installed tensorflow that might be a reason to use it. I am not sure, but for running cloud TPU jobs with the setup.py we have today, I've needed to hack it up to stop it from installing a new tf version that does not have proper TPU support. No need to resolve here, but that's something I will keep looking into.

Copy link
Contributor

Choose a reason for hiding this comment

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

I would suggest using setup.py. One caveat is that the current setting for version number [Link] may throw an error when installing with pip install . because it imports the package to get the version number before installing anything, which may encounter some not installed packages. For example, the user would have to install tensorflow before running pip install .. It is not a big deal though. The user can tell which package to install from the error.

CONTRIBUTING.md Outdated Show resolved Hide resolved
Copy link
Member

@qlzh727 qlzh727 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.

CONTRIBUTING.md Show resolved Hide resolved
@qlzh727
Copy link
Member

qlzh727 commented Jan 31, 2022

There are some existing testing utils in tensorflow/python/distribute for setting up various distribution strategies. Internally in google, the unit test can setup different hardware settings, eg multi-cpu/gpu/tpu and combinations, but it will be bit hard for any other local test env on user local. Only a few setting might work locally, eg mirror strategy with multi-cpu.

@qlzh727
Copy link
Member

qlzh727 commented Jan 31, 2022

We are trying to standardize a template for this file in the ecosystem at:

tensorflow/community#384

It would be nice If you could contribute to the review and adopt it also in the Keras ecosystem

Thanks for the reference. For the code style and linting, is there a standard formatter used by tf community? We would love to use that to avoid reinventing the wheel.

@bhack
Copy link
Contributor

bhack commented Jan 31, 2022

For the code style and linting, is there a standard formatter used by tf community? We would love to use that to avoid reinventing the wheel.

I've not tried to do it in the template as it is already quite hard to just focus the community attention on a very minimal but common baseline of empty sections headlines.

What I can tell you is that I believe in pre-commit hooks and also in pre-commits hooks prepared in the devel containers.
If you check some strategic search, also with the linting docs, contributors have a trend to abuse the CI also for sanity check and this will go to slow down the comments roundtrips around a PR and increase CI runs (with or without a manual policy for the authorization).

Just to take a look at some numbers on TF with few sample queries:
https://github.com/tensorflow/tensorflow/search?q=%22sanity+error%22&type=issues
https://github.com/tensorflow/tensorflow/search?q=%22sanity+build+failures%22&type=issues

But also with the small stats we have in Keras-cv check:
#14 (comment)

CONTRIBUTING.md Outdated Show resolved Hide resolved
CONTRIBUTING.md Outdated Show resolved Hide resolved
CONTRIBUTING.md Show resolved Hide resolved
CONTRIBUTING.md Outdated Show resolved Hide resolved
CONTRIBUTING.md Show resolved Hide resolved
CONTRIBUTING.md Outdated Show resolved Hide resolved
CONTRIBUTING.md Outdated Show resolved Hide resolved
```shell
git clone https://github.com/YOUR_GITHUB_USERNAME/keras.git
cd keras
pip install ".[tests]"
Copy link
Contributor

Choose a reason for hiding this comment

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

I would suggest using setup.py. One caveat is that the current setting for version number [Link] may throw an error when installing with pip install . because it imports the package to get the version number before installing anything, which may encounter some not installed packages. For example, the user would have to install tensorflow before running pip install .. It is not a big deal though. The user can tell which package to install from the error.

CONTRIBUTING.md Show resolved Hide resolved
Copy link
Member

@mattdangerw mattdangerw 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 edits! lgtm

CONTRIBUTING.md Outdated Show resolved Hide resolved
@LukeWood LukeWood merged commit 1eea133 into master Feb 1, 2022
@LukeWood LukeWood deleted the contributing branch February 21, 2022 19:35
ianstenbit pushed a commit to ianstenbit/keras-cv that referenced this pull request Aug 6, 2022
* Add a contributing guide

* Address Scott's comments.

* address Matt comments

* update to use github cli

* Update "Format the Code" header

* Address introduction of tools comment

* Update CONTRIBUTING.md
adhadse pushed a commit to adhadse/keras-cv that referenced this pull request Sep 17, 2022
* Add a contributing guide

* Address Scott's comments.

* address Matt comments

* update to use github cli

* Update "Format the Code" header

* Address introduction of tools comment

* Update CONTRIBUTING.md
freedomtan pushed a commit to freedomtan/keras-cv that referenced this pull request Jul 20, 2023
* Add log_cosh and huber loss

* Docstring standardization

* Format

* Standardize wrapper function docstrings
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants