Skip to content

Commit e18fb77

Browse files
committed
Merge branch 'master' into feature/migration-2
2 parents 121c747 + b9443a0 commit e18fb77

File tree

257 files changed

+8951
-4749
lines changed

Some content is hidden

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

257 files changed

+8951
-4749
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" # FIXME: bug with >= 0.4.4
5555
pip install . --requirement requirements/devel.txt
5656
pip list
5757
displayName: 'Install dependencies'

.azure-pipelines/ipu-tests.yml

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -72,26 +72,11 @@ jobs:
7272
python -c "import poptorch; print(poptorch.__version__)"
7373
displayName: "Check poptorch installation"
7474
75-
- bash: |
76-
wget https://pl-public-data.s3.amazonaws.com/legacy/checkpoints.zip -P legacy/
77-
unzip -o legacy/checkpoints.zip -d legacy/
78-
ls -l legacy/checkpoints/
79-
displayName: 'Get legacy checkpoints'
80-
8175
- bash: |
8276
source ${{ variables.poplar_sdk }}/poplar-ubuntu*/enable.sh
8377
source ${{ variables.poplar_sdk }}/popart-ubuntu*/enable.sh
8478
export POPTORCH_WAIT_FOR_IPU=1
85-
python -m coverage run --source pytorch_lightning -m pytest pytorch_lightning tests -v --junitxml=$(Build.StagingDirectory)/test-results.xml --durations=50
79+
python -m coverage run --source pytorch_lightning -m pytest tests/accelerators/test_ipu.py -v --junitxml=$(Build.StagingDirectory)/test-results.xml --durations=50
8680
env:
8781
MKL_THREADING_LAYER: "GNU"
8882
displayName: 'Testing: standard'
89-
90-
- bash: |
91-
source ${{ variables.poplar_sdk }}/poplar-ubuntu*/enable.sh
92-
source ${{ variables.poplar_sdk }}/popart-ubuntu*/enable.sh
93-
export POPTORCH_WAIT_FOR_IPU=1
94-
bash tests/special_tests.sh
95-
env:
96-
MKL_THREADING_LAYER: "GNU"
97-
displayName: 'Testing: special'

.codecov.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@ coverage:
3636
# https://codecov.readme.io/v1.0/docs/commit-status
3737
project:
3838
default:
39-
against: auto
4039
target: 99% # specify the target coverage for each commit status
4140
threshold: 30% # allow this little decrease on project
4241
# https://github.com/codecov/support/wiki/Filtering-Branches
@@ -45,11 +44,14 @@ coverage:
4544
# https://github.com/codecov/support/wiki/Patch-Status
4645
patch:
4746
default:
48-
against: auto
4947
target: 50% # specify the target "X%" coverage to hit
5048
# threshold: 50% # allow this much decrease on patch
5149
changes: false
5250

51+
# https://docs.codecov.com/docs/github-checks#disabling-github-checks-patch-annotations
52+
github_checks:
53+
annotations: false
54+
5355
parsers:
5456
gcov:
5557
branch_detection:

.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: 64 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

@@ -191,6 +195,15 @@ python -m pip install ".[dev, examples]"
191195
python -m pip install pre-commit
192196
```
193197

198+
Additionally, for testing backward compatibility with older versions of PyTorch Lightning, you also need to download all saved version-checkpoints from the public AWS storage. Run the following script to get all saved version-checkpoints:
199+
200+
```bash
201+
wget https://pl-public-data.s3.amazonaws.com/legacy/checkpoints.zip -P legacy/
202+
unzip -o legacy/checkpoints.zip -d legacy/
203+
```
204+
205+
Note: These checkpoints are generated to set baselines for maintaining backward compatibility with legacy versions of PyTorch Lightning. Details of checkpoints for back-compatibility can be found [here](https://github.com/PyTorchLightning/pytorch-lightning/blob/master/legacy/README.md).
206+
194207
You can run the full test-case in your terminal via this make script:
195208

196209
```bash
@@ -223,18 +236,18 @@ We welcome any useful contribution! For your convenience here's a recommended wo
223236
- Create a branch and prepare your changes.
224237
- Tip: do not work with your master directly, it may become complicated when you need to rebase.
225238
- 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!
239+
1. Test your code!
227240
- 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.
228241
- Make sure your new tests cover all different edge cases.
229242
- 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".
243+
1. Create a "Draft PR" which is clearly marked, to let us know you don't need feedback yet.
244+
1. When you feel ready for integrating your work, mark your PR "Ready for review".
232245
- Your code should be readable and follow the project's design principles.
233246
- Make sure all tests are passing.
234247
- 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.
248+
1. Use tags in PR name for following cases:
249+
- **\[blocked by #<number>\]** if your work is dependent on other PRs.
250+
- **\[wip\]** when you start to re-edit your work, mark it so no one will accidentally merge it in meantime.
238251

239252
### Question & Answer
240253

@@ -275,20 +288,21 @@ git rebase upstream/master
275288
git push -f
276289
```
277290

278-
#### How to add new tests?**
291+
#### How to add new tests?
279292

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

282295
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
296+
297+
- (recommended) [Visual Testing with pytest](https://www.youtube.com/playlist?list=PLCTHcU1KoD99Rim2tzg-IhYY2iu9FFvNo) from JetBrains on YouTube
298+
- [Effective Python Testing With Pytest](https://realpython.com/pytest-python-testing/) article on realpython.com
285299

286300
Here is the process to create a new test
287301

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`.
302+
- 0. Optional: Follow tutorials !
303+
- 1. Find a file in tests/ which match what you want to test. If none, create one.
304+
- 2. Use this template to get started !
305+
- 3. Use `BoringModel and derivates to test out your code`.
292306

293307
```python
294308
# TEST SHOULD BE IN YOUR FILE: tests/..../...py
@@ -318,47 +332,49 @@ def test_explain_what_is_being_tested(tmpdir):
318332
# assert the behaviour is correct.
319333
assert ...
320334
```
335+
321336
run our/your test with
337+
322338
```bash
323339
python -m pytest tests/..../...py::test_explain_what_is_being_tested --verbose --capture=no
324340
```
325341

326-
327342
#### How to fix PR with mixed base and target branches?
328343

329344
Sometimes you start your PR as a bug-fix but it turns out to be more of a feature (or the other way around).
330345
Do not panic, the solution is very straightforward and quite simple.
331346
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...
347+
348+
- Ask someone from Core to change the base/target branch to the correct one
349+
- Rebase or cherry-pick your commits onto the correct base branch...
334350

335351
Let's show how to deal with the git...
336352
the sample case is moving a PR from `master` to `release/1.2-dev` assuming my branch name is `my-branch`
337353
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-
```
361354

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

363379
### Bonus Workflow Tip
364380

0 commit comments

Comments
 (0)