Skip to content

Commit d1923c4

Browse files
committed
Merge branch 'master' into mypy_utilities_debugging
2 parents 9bf97dc + 9ca02f5 commit d1923c4

File tree

85 files changed

+2026
-1200
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

85 files changed

+2026
-1200
lines changed

.azure-pipelines/gpu-tests.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ jobs:
5151
- bash: |
5252
python -c "fname = 'requirements/extra.txt' ; lines = [line for line in open(fname).readlines() if 'horovod' not in line] ; open(fname, 'w').writelines(lines)"
5353
pip install fairscale>=0.3.4
54-
pip install deepspeed>=0.4.0 -U
54+
pip install "deepspeed>=0.4.3, !=0.4.4" # FIXME: bug with 0.4.4
5555
pip install . --requirement requirements/devel.txt
5656
pip list
5757
displayName: 'Install dependencies'

.github/BECOMING_A_CORE_CONTRIBUTOR.md

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,22 +6,26 @@ We're currently recruiting for a team of 5 core maintainers.
66
As a core maintainer you will have a strong say in the direction of the project. Big changes will require a majority of maintainers to agree.
77

88
## Code of conduct
9+
910
First and foremost, you'll be evaluated against [these core values](https://github.com/PyTorchLightning/pytorch-lightning/blob/master/.github/CONTRIBUTING.md). Any code we commit or feature we add needs to align with those core values.
1011

1112
## The bar for joining the team
13+
1214
Lightning is being used to solve really hard problems at the top AI labs in the world. As such, the bar for adding team members is extremely high. Candidates must have solid engineering skills, have a good eye for user experience, and must be a power user of Lightning and PyTorch.
1315

1416
With that said, the Lightning team will be diverse and a reflection of an inclusive AI community. You don't have to be an engineer to contribute! Scientists with great usability intuition and PyTorch ninja skills are welcomed!
1517

1618
## Responsibilities:
19+
1720
The responsibilities mainly revolve around 3 things.
1821

1922
### Github issues
23+
2024
- Here we want to help users have an amazing experience. These range from questions from new people getting into DL to questions from researchers about doing something esoteric with Lightning
21-
Often, these issues require some sort of bug fix, document clarification or new functionality to be scoped out.
25+
Often, these issues require some sort of bug fix, document clarification or new functionality to be scoped out.
2226

2327
- To become a core member you must resolve at least 10 Github issues which align with the API design goals for Lightning. By the end of these 10 issues I should feel comfortable in the way you answer user questions
24-
Pleasant/helpful tone.
28+
Pleasant/helpful tone.
2529

2630
- Can abstract from that issue or bug into functionality that might solve other related issues or makes the platform more flexible.
2731

@@ -37,22 +41,25 @@ Pleasant/helpful tone.
3741
- Ask yourself, could a non-engineer understand what’s happening here?
3842
- Make sure new tests are written
3943
- Is this NECESSARY for Lightning? There are some PRs which are just purely about adding engineering complexity which have no place in Lightning.
40-
Guidance
44+
Guidance
4145
- Some other PRs are for people who are wanting to get involved and add something unnecessary. We do want their help though! So don’t approve the PR, but direct them to a Github issue that they might be interested in helping with instead!
4246
- To be considered for core contributor, please review 10 PRs and help the authors land it on master. Once you've finished the review, ping me
43-
for a sanity check. At the end of 10 PRs if your PR reviews are inline with expectations described above, then you can merge PRs on your own going forward,
44-
otherwise we'll do a few more until we're both comfortable :)
47+
for a sanity check. At the end of 10 PRs if your PR reviews are inline with expectations described above, then you can merge PRs on your own going forward,
48+
otherwise we'll do a few more until we're both comfortable :)
4549

4650
### Project directions
51+
4752
There are some big decisions which the project must make. For these I expect core contributors to have something meaningful to add if it’s their area of expertise.
4853

4954
### Diversity
55+
5056
Lightning should reflect the broader community it serves. As such we should have scientists/researchers from
5157
different fields contributing!
5258

5359
The first 5 core contributors will fit this profile. Thus if you overlap strongly with experiences and expertise as someone else on the team, you might have to wait until the next set of contributors are added.
5460

5561
### Summary: Requirements to apply
62+
5663
The goal is to be inline with expectations for solving issues by the last one so you can do them on your own. If not, I might ask you to solve a few more specific ones.
5764

5865
- Solve 10+ Github issues.

.github/CODE_OF_CONDUCT.md

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -14,22 +14,22 @@ appearance, race, religion, or sexual identity and orientation.
1414
Examples of behavior that contributes to creating a positive environment
1515
include:
1616

17-
* Using welcoming and inclusive language
18-
* Being respectful of differing viewpoints and experiences
19-
* Gracefully accepting constructive criticism
20-
* Focusing on what is best for the community
21-
* Showing empathy towards other community members
17+
- Using welcoming and inclusive language
18+
- Being respectful of differing viewpoints and experiences
19+
- Gracefully accepting constructive criticism
20+
- Focusing on what is best for the community
21+
- Showing empathy towards other community members
2222

2323
Examples of unacceptable behavior by participants include:
2424

25-
* The use of sexualized language or imagery and unwelcome sexual attention or
26-
advances
27-
* Trolling, insulting/derogatory comments, and personal or political attacks
28-
* Public or private harassment
29-
* Publishing others' private information, such as a physical or electronic
30-
address, without explicit permission
31-
* Other conduct which could reasonably be considered inappropriate in a
32-
professional setting
25+
- The use of sexualized language or imagery and unwelcome sexual attention or
26+
advances
27+
- Trolling, insulting/derogatory comments, and personal or political attacks
28+
- Public or private harassment
29+
- Publishing others' private information, such as a physical or electronic
30+
address, without explicit permission
31+
- Other conduct which could reasonably be considered inappropriate in a
32+
professional setting
3333

3434
## Our Responsibilities
3535

@@ -70,7 +70,7 @@ members of the project's leadership.
7070
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
7171
available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html
7272

73-
[homepage]: https://www.contributor-covenant.org
74-
7573
For answers to common questions about this code of conduct, see
7674
https://www.contributor-covenant.org/faq
75+
76+
[homepage]: https://www.contributor-covenant.org

.github/CONTRIBUTING.md

Lines changed: 55 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ As a researcher, you can't have any part of your code going wrong. So, make thor
5656

5757
Have a favorite feature from other libraries like fast.ai or transformers? Those should just work with lightning as well. Grab your favorite model or learning rate scheduler from your favorite library and run it in Lightning.
5858

59-
---
59+
______________________________________________________________________
6060

6161
## Contribution Types
6262

@@ -73,26 +73,28 @@ A lot of good work has already been done in project mechanics (requirements.txt,
7373
- Add details on how to reproduce the issue - a minimal test case is always best, colab is also great.
7474
Note, that the sample code shall be minimal and if needed with publicly available data.
7575

76-
2. Try to fix it or recommend a solution. We highly recommend to use test-driven approach:
76+
1. Try to fix it or recommend a solution. We highly recommend to use test-driven approach:
7777

7878
- Convert your minimal code example to a unit/integration test with assert on expected results.
7979
- Start by debugging the issue... You can run just this particular test in your IDE and draft a fix.
8080
- Verify that your test case fails on the master branch and only passes with the fix applied.
8181

82-
3. Submit a PR!
82+
1. Submit a PR!
8383

84-
_**Note**, even if you do not find the solution, sending a PR with a test covering the issue is a valid contribution, and we can help you or finish it with you :]_
84+
_**Note**, even if you do not find the solution, sending a PR with a test covering the issue is a valid contribution, and we can help you or finish it with you :\]_
8585

8686
### New Features:
8787

8888
1. Submit a GitHub issue - describe what is the motivation of such feature (adding the use case, or an example is helpful).
89-
2. Determine the feature scope with us.
90-
3. Submit a PR! We recommend test driven approach to adding new features as well:
89+
90+
1. Determine the feature scope with us.
91+
92+
1. Submit a PR! We recommend test driven approach to adding new features as well:
9193

9294
- Write a test for the functionality you want to add.
9395
- Write the functional code until the test passes.
9496

95-
4. Add/update the relevant tests!
97+
1. Add/update the relevant tests!
9698

9799
- [This PR](https://github.com/PyTorchLightning/pytorch-lightning/pull/2671) is a good example for adding a new metric, and [this one for a new logger](https://github.com/PyTorchLightning/pytorch-lightning/pull/2721).
98100

@@ -102,12 +104,14 @@ Want to keep Lightning healthy? Love seeing those green tests? So do we! How to
102104

103105
Most of the tests in PyTorch Lightning train a trial MNIST model under various trainer conditions (ddp, ddp2+amp, etc...). The tests expect the model to perform to a reasonable degree of testing accuracy to pass. Want to add a new test case and not sure how? [Talk to us!](https://join.slack.com/t/pytorch-lightning/shared_invite/zt-pw5v393p-qRaDgEk24~EjiZNBpSQFgQ)
104106

105-
---
107+
______________________________________________________________________
106108

107109
## Guidelines
108110

109111
### Developments scripts
112+
110113
To build the documentation locally, simply execute the following commands from project root (only for Unix):
114+
111115
- `make clean` cleans repo from temp/generated files
112116
- `make docs` builds documentation under _docs/build/html_
113117
- `make test` runs all project's tests with coverage
@@ -121,7 +125,7 @@ In case you adding new dependencies, make sure that they are compatible with the
121125
### Coding Style
122126

123127
1. Use f-strings for output formation (except logging when we stay with lazy `logging.info("Hello %s!", name)`.
124-
2. You can use `pre-commit` to make sure your code style is correct.
128+
1. You can use `pre-commit` to make sure your code style is correct.
125129

126130
### Documentation
127131

@@ -223,18 +227,18 @@ We welcome any useful contribution! For your convenience here's a recommended wo
223227
- Create a branch and prepare your changes.
224228
- Tip: do not work with your master directly, it may become complicated when you need to rebase.
225229
- Tip: give your PR a good name! It will be useful later when you may work on multiple tasks/PRs.
226-
2. Test your code!
230+
1. Test your code!
227231
- It is always good practice to start coding by creating a test case, verifying it breaks with current behaviour, and passes with your new changes.
228232
- Make sure your new tests cover all different edge cases.
229233
- Make sure all exceptions are handled.
230-
3. Create a "Draft PR" which is clearly marked, to let us know you don't need feedback yet.
231-
4. When you feel ready for integrating your work, mark your PR "Ready for review".
234+
1. Create a "Draft PR" which is clearly marked, to let us know you don't need feedback yet.
235+
1. When you feel ready for integrating your work, mark your PR "Ready for review".
232236
- Your code should be readable and follow the project's design principles.
233237
- Make sure all tests are passing.
234238
- Make sure you add a GitHub issue to your PR.
235-
5. Use tags in PR name for following cases:
236-
- **[blocked by #<number>]** if your work is dependent on other PRs.
237-
- **[wip]** when you start to re-edit your work, mark it so no one will accidentally merge it in meantime.
239+
1. Use tags in PR name for following cases:
240+
- **\[blocked by #<number>\]** if your work is dependent on other PRs.
241+
- **\[wip\]** when you start to re-edit your work, mark it so no one will accidentally merge it in meantime.
238242

239243
### Question & Answer
240244

@@ -275,20 +279,21 @@ git rebase upstream/master
275279
git push -f
276280
```
277281

278-
#### How to add new tests?**
282+
#### How to add new tests?
279283

280284
We are using [pytest](https://docs.pytest.org/en/stable/) in Pytorch Lightning.
281285

282286
Here are tutorials:
283-
* (recommended) [Visual Testing with pytest](https://www.youtube.com/playlist?list=PLCTHcU1KoD99Rim2tzg-IhYY2iu9FFvNo) from JetBrains on YouTube
284-
* [Effective Python Testing With Pytest](https://realpython.com/pytest-python-testing/) article on realpython.com
287+
288+
- (recommended) [Visual Testing with pytest](https://www.youtube.com/playlist?list=PLCTHcU1KoD99Rim2tzg-IhYY2iu9FFvNo) from JetBrains on YouTube
289+
- [Effective Python Testing With Pytest](https://realpython.com/pytest-python-testing/) article on realpython.com
285290

286291
Here is the process to create a new test
287292

288-
* 0. Optional: Follow tutorials !
289-
* 1. Find a file in tests/ which match what you want to test. If none, create one.
290-
* 2. Use this template to get started !
291-
* 3. Use `BoringModel and derivates to test out your code`.
293+
- 0. Optional: Follow tutorials !
294+
- 1. Find a file in tests/ which match what you want to test. If none, create one.
295+
- 2. Use this template to get started !
296+
- 3. Use `BoringModel and derivates to test out your code`.
292297

293298
```python
294299
# TEST SHOULD BE IN YOUR FILE: tests/..../...py
@@ -318,47 +323,49 @@ def test_explain_what_is_being_tested(tmpdir):
318323
# assert the behaviour is correct.
319324
assert ...
320325
```
326+
321327
run our/your test with
328+
322329
```bash
323330
python -m pytest tests/..../...py::test_explain_what_is_being_tested --verbose --capture=no
324331
```
325332

326-
327333
#### How to fix PR with mixed base and target branches?
328334

329335
Sometimes you start your PR as a bug-fix but it turns out to be more of a feature (or the other way around).
330336
Do not panic, the solution is very straightforward and quite simple.
331337
All you need to do are these two steps in arbitrary order:
332-
- Ask someone from Core to change the base/target branch to the correct one
333-
- Rebase or cherry-pick your commits onto the correct base branch...
338+
339+
- Ask someone from Core to change the base/target branch to the correct one
340+
- Rebase or cherry-pick your commits onto the correct base branch...
334341

335342
Let's show how to deal with the git...
336343
the sample case is moving a PR from `master` to `release/1.2-dev` assuming my branch name is `my-branch`
337344
and the last true master commit is `ccc111` and your first commit is `mmm222`.
338-
* **Cherry-picking** way
339-
```bash
340-
git checkout my-branch
341-
# create a local backup of your branch
342-
git checkout -b my-branch-backup
343-
# reset your branch to the correct base
344-
git reset release/1.2-dev --hard
345-
# ACTION: this step is much easier to do with IDE
346-
# so open one and cherry-pick your last commits from `my-branch-backup`
347-
# resolve all eventual conflict as the new base may contain different code
348-
# when all done, push back to the open PR
349-
git push -f
350-
```
351-
* **Rebasing way**, see more about [rebase onto usage](https://womanonrails.com/git-rebase-onto)
352-
```bash
353-
git checkout my-branch
354-
# rebase your commits on the correct branch
355-
git rebase --onto release/1.2-dev ccc111
356-
# if there is no collision you shall see just success
357-
# eventually you would need to resolve collision and in such case follow the instruction in terminal
358-
# when all done, push back to the open PR
359-
git push -f
360-
```
361345

346+
- **Cherry-picking** way
347+
```bash
348+
git checkout my-branch
349+
# create a local backup of your branch
350+
git checkout -b my-branch-backup
351+
# reset your branch to the correct base
352+
git reset release/1.2-dev --hard
353+
# ACTION: this step is much easier to do with IDE
354+
# so open one and cherry-pick your last commits from `my-branch-backup`
355+
# resolve all eventual conflict as the new base may contain different code
356+
# when all done, push back to the open PR
357+
git push -f
358+
```
359+
- **Rebasing way**, see more about [rebase onto usage](https://womanonrails.com/git-rebase-onto)
360+
```bash
361+
git checkout my-branch
362+
# rebase your commits on the correct branch
363+
git rebase --onto release/1.2-dev ccc111
364+
# if there is no collision you shall see just success
365+
# eventually you would need to resolve collision and in such case follow the instruction in terminal
366+
# when all done, push back to the open PR
367+
git push -f
368+
```
362369

363370
### Bonus Workflow Tip
364371

.github/ISSUE_TEMPLATE/bug_report.md

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ about: Create a report to help us improve
44
title: ''
55
labels: bug / fix, help wanted
66
assignees: ''
7-
87
---
8+
99
## 🐛 Bug
1010

1111
<!-- A clear and concise description of what the bug is. -->
@@ -46,15 +46,15 @@ python collect_env_details.py
4646
You can also fill out the list below manually.
4747
-->
4848

49-
- PyTorch Lightning Version (e.g., 1.3.0):
50-
- PyTorch Version (e.g., 1.8)
51-
- Python version:
52-
- OS (e.g., Linux):
53-
- CUDA/cuDNN version:
54-
- GPU models and configuration:
55-
- How you installed PyTorch (`conda`, `pip`, source):
56-
- If compiling from source, the output of `torch.__config__.show()`:
57-
- Any other relevant information:
49+
- PyTorch Lightning Version (e.g., 1.3.0):
50+
- PyTorch Version (e.g., 1.8)
51+
- Python version:
52+
- OS (e.g., Linux):
53+
- CUDA/cuDNN version:
54+
- GPU models and configuration:
55+
- How you installed PyTorch (`conda`, `pip`, source):
56+
- If compiling from source, the output of `torch.__config__.show()`:
57+
- Any other relevant information:
5858

5959
### Additional context
6060

.github/ISSUE_TEMPLATE/documentation.md

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,15 @@ about: Typos and doc fixes
44
title: ''
55
labels: typo, documentation
66
assignees: ''
7-
87
---
98

109
## 📚 Documentation
1110

1211
For typos and doc fixes, please go ahead and:
1312

1413
1. Create an issue.
15-
2. Fix the typo.
16-
3. Submit a PR.
14+
1. Fix the typo.
15+
1. Submit a PR.
1716

1817
For very simple fixes, you can submit a PR without a linked issue.
1918

.github/ISSUE_TEMPLATE/feature_request.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ about: Suggest an idea for this project
44
title: ''
55
labels: enhancement, help wanted
66
assignees: ''
7-
87
---
98

109
## 🚀 Feature
@@ -27,7 +26,7 @@ assignees: ''
2726

2827
<!-- Add any other context or screenshots about the feature request here. -->
2928

30-
---
29+
______________________________________________________________________
3130

3231
#### If you enjoy Lightning, check out our other projects! ⚡
3332

0 commit comments

Comments
 (0)