Unverified Commit bb9e7588 authored by Nicolas Hug's avatar Nicolas Hug Committed by GitHub
Browse files

Added CONTRIBUTING.md (#1241)


Co-authored-by: default avatarmoto <855818+mthrok@users.noreply.github.com>
parent 77de2b96
# Contributing to Torchaudio
We want to make contributing to this project as easy and transparent as possible.
## TL;DR
Please let us know if you encounter a bug by filing an [issue](https://github.com/pytorch/audio/issues).
We appreciate all contributions. If you are planning to contribute back
bug-fixes, please do so without any further discussion.
If you plan to contribute new features, utility functions or extensions to the
core, please first open an issue and discuss the feature with us. Sending a PR
without discussion might end up resulting in a rejected PR, because we might be
taking the core in a different direction than you might be aware of.
Fixing bugs and implementing new features are not the only way you can
contribute. It also helps the project when you report problems you're facing,
and when you give a :+1: on issues that others reported and that are relevant
to you.
You can also help by improving the documentation. This is no less important
than improving the library itself! If you find a typo in the documentation,
do not hesitate to submit a pull request.
If you're not sure what you want to work on, you can pick an issue from the
[list of open issues labelled as "help
wanted"](https://github.com/pytorch/audio/issues?q=is%3Aopen+is%3Aissue+label%3A%22help+wanted%22).
Comment on the issue that you want to work on it and send a PR with your fix
(see below).
## Development installation
We recommend using a `conda` environment to contribute efficiently to
torchaudio.
### Install PyTorch Nightly
```bash
conda install pytorch -c pytorch-nightly
```
### Install Torchaudio
```bash
pip install cmake ninja
```
```bash
git clone https://github.com/pytorch/audio.git
cd audio
git submodule update --init --recursive
BUILD_SOX=1 python setup.py develop
# or, for OSX
# BUILD_SOX=1 MACOSX_DEPLOYMENT_TARGET=10.9 CC=clang CXX=clang++ python setup.py develop
# for C++ debugging, please use DEBUG=1
# DEBUG=1 python setup.py install
```
Note: you don't need to use `BUILD_SOX=1` if you have `libsox-dev` installed
already. If you built sox however, set the `PATH` variable so that the tests
properly use the newly built `sox` binary:
```bash
export PATH="<path_to_torchaudio>/third_party/install/bin:${PATH}"
```
The following dependencies are also needed for testing:
```bash
pip install typing pytest scipy numpy parametrized
```
## Development Process
If you plan to modify the code or documentation, please follow the steps below:
1. Fork the repository and create your branch from `master`: `$ git checkout master && git checkout -b my_cool_feature`
2. If you have modified the code (new feature or bug-fix), [please add tests](.test/torchaudio_unittest/).
3. If you have changed APIs, [update the documentation](#Documentation).
For more details about pull requests,
please read [GitHub's guides](https://docs.github.com/en/github/collaborating-with-issues-and-pull-requests/creating-a-pull-request).
If you would like to contribute a new model, please see [here](#New-model).
If you would like to contribute a new dataset, please see [here](#New-dataset).
## Testing
Please refer to our [testing guidelines](.test/torchaudio_unittest/) for more
details.
## Documentation
Torchaudio uses [Google style](http://sphinxcontrib-napoleon.readthedocs.io/en/latest/example_google.html)
for formatting docstrings. Length of line inside docstrings block must be limited to 120 characters.
To build the docs, first install the requirements:
```bash
cd docs
pip install -r requirements.txt
```
Then:
```bash
cd docs
make html
```
The built docs should now be available in `docs/build/html`
## License
By contributing to Torchaudio, you agree that your contributions will be licensed
under the LICENSE file in the root directory of this source tree.
......@@ -232,15 +232,7 @@ Complex numbers are supported via tensors of dimension (..., 2), and torchaudio
Contributing Guidelines
-----------------------
Please let us know if you encounter a bug by filing an [issue](https://github.com/pytorch/audio/issues).
We appreciate all contributions. If you are planning to contribute back
bug-fixes, please do so without any further discussion.
If you plan to contribute new features, utility functions or extensions to the
core, please first open an issue and discuss the feature with us. Sending a PR
without discussion might end up resulting in a rejected PR, because we might be
taking the core in a different direction than you might be aware of.
Please refer to [CONTRIBUTING.md](./CONTRIBUTING.md)
Disclaimer on Datasets
----------------------
......
......@@ -2,9 +2,25 @@
## How to run test
You can use `pytest` to run `torchaudio`'s test suites. See https://docs.pytest.org/ for the detail of how to use `pytest` command. The `parametrized` package is also needed; it can be installed via `pip` or with ` conda install -c conda-forge parameterized`.
You can use `pytest` to run `torchaudio`'s test suites. See
https://docs.pytest.org/ for the detail of how to use `pytest` command.
For testing, the following packages are needed:
```bash
pip install typing pytest scipy numpy parametrized
```
Make sure to follow the installation instruction in the [contributing
guide](../../CONTRIBUTING.md) first. For running `kaldi`-related tests:
```bash
export PATH="${PATH}:<path_to_kaldi>/src/featbin/"
```
Some useful pytest commands:
```bash
# List up all the tests
pytest test --collect-only
# Run all the test suites
......@@ -21,6 +37,11 @@ pytest test/torchaudio_unittest/sox_io_backend -k load # only runs tests where
**Note**
We use PyTorch's test utilities instead of `pytest` frameworks when writing tests to avoid reinventing the wheel for Tensor comparison.
Also, while we recommend using `pytest` for *running* the tests, we cannot
make `pytest` a testing dependency of `torchaudio`. As a result, you should
not import `pytest` or its submodules in the test files; Use the Python
`unittest` builtin module instead, or the `parametrized` package to
parametrize tests.
## Structure of tests
......@@ -28,7 +49,7 @@ The following is an overview of the tests and related modules for `torchaudio`.
### Purpose specific test suites
#### Numerical compatibility agains existing software
#### Numerical compatibility against existing software
- [Librosa compatibility test](./librosa_compatibility_test.py)
Test suite for numerical compatibility against librosa.
- [SoX compatibility test](./sox_compatibility_test.py)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment