CONTRIBUTING.md 4.52 KB
Newer Older
Nicolas Hug's avatar
Nicolas Hug committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
# 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.

16
17
18
19
Facebook has a [bounty program](https://www.facebook.com/whitehat/) for the
safe disclosure of security bugs. In those cases, please go through the
process outlined on that page and do not file a public issue.

Nicolas Hug's avatar
Nicolas Hug committed
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
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).

35
36
37
38
39
40
## Contributor License Agreement ("CLA")
In order to accept your pull request, we need you to submit a CLA. You only need
to do this once to work on any of Facebook's open source projects.

Complete your CLA here: <https://code.facebook.com/cla>

Nicolas Hug's avatar
Nicolas Hug committed
41
42
43
44
45
## Development installation

We recommend using a `conda` environment to contribute efficiently to
torchaudio.

46
### Install PyTorch Nightly
Nicolas Hug's avatar
Nicolas Hug committed
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65

```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
moto's avatar
moto committed
66
# DEBUG=1 python setup.py develop
Nicolas Hug's avatar
Nicolas Hug committed
67
68
```

69
If you built sox, set the `PATH` variable so that the tests properly use the newly built `sox` binary:
Nicolas Hug's avatar
Nicolas Hug committed
70
71
72
73
74
75
76
77

```bash
export PATH="<path_to_torchaudio>/third_party/install/bin:${PATH}"
```

The following dependencies are also needed for testing:

```bash
Jcaw's avatar
Jcaw committed
78
pip install typing pytest scipy numpy parameterized
Nicolas Hug's avatar
Nicolas Hug committed
79
80
```

yangarbiter's avatar
yangarbiter committed
81
82
83
84
85
86
87
88
89
Optional packages to install if you want to run related tests:

- `librosa`
- `requests`
- `soundfile`
- `kaldi_io`
- `transformers`
- `fairseq` (it has to be newer than `0.10.2`, so you will need to install from
  source. Commit `e6eddd80` is known to work.)
90
91
- `unidecode` (dependency for testing text preprocessing functions for examples/pipeline_tacotron2)
- `inflect` (dependency for testing text preprocessing functions for examples/pipeline_tacotron2)
yangarbiter's avatar
yangarbiter committed
92

Nicolas Hug's avatar
Nicolas Hug committed
93
94
95
96
97
## 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`
98
2. If you have modified the code (new feature or bug-fix), [please add tests](test/torchaudio_unittest/).
Nicolas Hug's avatar
Nicolas Hug committed
99
100
3. If you have changed APIs, [update the documentation](#Documentation).

101
102
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).
Nicolas Hug's avatar
Nicolas Hug committed
103
104
105

If you would like to contribute a new model, please see [here](#New-model).

106
If you would like to contribute a new dataset, please see [here](#New-dataset).
Nicolas Hug's avatar
Nicolas Hug committed
107
108
109

## Testing

110
Please refer to our [testing guidelines](test/torchaudio_unittest/) for more
Nicolas Hug's avatar
Nicolas Hug committed
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
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.