diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md index 2e6dbaca2b..69a95223c7 100644 --- a/.github/CONTRIBUTING.md +++ b/.github/CONTRIBUTING.md @@ -31,7 +31,7 @@ As a researcher, you can't have any part of your code going wrong. So, make thor PyTorch Lightning Bolts is highly interoperable with PyTorch Lightning and PyTorch. ---- +______________________________________________________________________ ## Contribution Types @@ -48,26 +48,28 @@ A lot of good work has already been done in project mechanics (requirements/base - Add details on how to reproduce the issue - a minimal test case is always best, colab is also great. Note, that the sample code shall be minimal and if needed with publicly available data. -2. Try to fix it or recommend a solution. We highly recommend to use test-driven approach: +1. Try to fix it or recommend a solution. We highly recommend to use test-driven approach: - Convert your minimal code example to a unit/integration test with assert on expected results. - Start by debugging the issue... You can run just this particular test in your IDE and draft a fix. - Verify that your test case fails on the master branch and only passes with the fix applied. -3. Submit a PR! +1. Submit a PR! -_**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 :]_ +_**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 :\]_ ### New Features: 1. Submit a GitHub issue - describe what is the motivation of such feature (adding the use case or an example is helpful). -2. Let's discuss to determine the feature scope. -3. Submit a PR! We recommend test driven approach to adding new features as well: + +1. Let's discuss to determine the feature scope. + +1. Submit a PR! We recommend test driven approach to adding new features as well: - Write a test for the functionality you want to add. - Write the functional code until the test passes. -4. Add/update the relevant tests! +1. Add/update the relevant tests! - [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). @@ -76,10 +78,10 @@ _**Note**, even if you do not find the solution, sending a PR with a test coveri PyTorch Lightning Bolts makes several research models for ready usage. Following are general guidelines for adding new models. 1. Models which are standard baselines -2. Whose results are reproduced properly either by us or by authors. -3. Top models which are not SOTA but highly cited for production usage / for other uses. (E.g. Mobile BERT, MobileNets, FBNets). -4. Do not reinvent the wheel, natively support torchvision, torchtext, torchaudio models. -5. Use open source licensed models. +1. Whose results are reproduced properly either by us or by authors. +1. Top models which are not SOTA but highly cited for production usage / for other uses. (E.g. Mobile BERT, MobileNets, FBNets). +1. Do not reinvent the wheel, natively support torchvision, torchtext, torchaudio models. +1. Use open source licensed models. Please raise an issue before adding a new model. Please let us know why the particular model is important for bolts. There are tons of models that keep coming. It is very difficult to support every model. @@ -101,8 +103,7 @@ make test 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) -**Note before submitting the PR, make sure you have run `pre-commit run`.** ---- +## **Note before submitting the PR, make sure you have run `pre-commit run`.** ## Guidelines @@ -120,10 +121,10 @@ In case you adding new dependencies, make sure that they are compatible with the All help is extremely welcome - reporting bugs, fixing documentation, adding test cases, solving issues and preparing bug fixes. To solve some issues you can start with label [good first issue](https://github.com/PyTorchLightning/lightning-bolts/issues?q=is%3Aissue+is%3Aopen+label%3A%22good+first+issue%22) or chose something close to your domain with label [help wanted](https://github.com/PyTorchLightning/lightning-bolts/issues?q=is%3Aissue+is%3Aopen+label%3A%22help+wanted%22). Before you start to implement anything check that the issue description that it is clear and self-assign the task to you (if it is not possible, just comment that you take it and we assign it to you...). -2. **Is there a recommendation for branch names?** +1. **Is there a recommendation for branch names?** We do not rely on the name convention so far you are working with your own fork. Anyway it would be nice to follow this convention `/_` where the types are: `bugfix`, `feature`, `docs`, `tests`, ... -3. **I have a model in other framework than PyTorch, how do I add it here?** +1. **I have a model in other framework than PyTorch, how do I add it here?** Since PyTorch Lightning is written on top of PyTorch. We need models in PyTorch only. Also, we would need same or equivalent results with PyTorch Lightning after converting the models from other frameworks. diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md index 8ad7c2b111..5ca42c5dc2 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.md +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -4,7 +4,6 @@ about: Create a report to help us improve title: '' labels: bug / fix, help wanted assignees: '' - --- ## 🐛 Bug @@ -16,14 +15,14 @@ assignees: '' Steps to reproduce the behavior: 1. Go to '...' -2. Run '....' -3. Scroll down to '....' -4. See error +1. Run '....' +1. Scroll down to '....' +1. See error - #### Code sample + @@ -33,14 +32,14 @@ Minimal means having the shortest code but still preserving the bug. --> ### Environment - - PyTorch Version (e.g., 1.0): - - OS (e.g., Linux): - - How you installed PyTorch (`conda`, `pip`, source): - - Build command you used (if compiling from source): - - Python version: - - CUDA/cuDNN version: - - GPU models and configuration: - - Any other relevant information: +- PyTorch Version (e.g., 1.0): +- OS (e.g., Linux): +- How you installed PyTorch (`conda`, `pip`, source): +- Build command you used (if compiling from source): +- Python version: +- CUDA/cuDNN version: +- GPU models and configuration: +- Any other relevant information: ### Additional context diff --git a/.github/ISSUE_TEMPLATE/documentation.md b/.github/ISSUE_TEMPLATE/documentation.md index 9b3298dcaa..c74b340800 100644 --- a/.github/ISSUE_TEMPLATE/documentation.md +++ b/.github/ISSUE_TEMPLATE/documentation.md @@ -4,7 +4,6 @@ about: Typos and doc fixes title: '' labels: documentation assignees: '' - --- ## 📚 Documentation @@ -12,7 +11,7 @@ assignees: '' For typos and doc fixes, please go ahead and: 1. Create an issue. -2. Fix the typo. -3. Submit a PR. +1. Fix the typo. +1. Submit a PR. Thanks! diff --git a/.github/ISSUE_TEMPLATE/feature_request.md b/.github/ISSUE_TEMPLATE/feature_request.md index 3350917aa0..ed24db85b0 100644 --- a/.github/ISSUE_TEMPLATE/feature_request.md +++ b/.github/ISSUE_TEMPLATE/feature_request.md @@ -4,10 +4,10 @@ about: Suggest an idea for this project title: '' labels: enhancement, help wanted assignees: '' - --- ## 🚀 Feature + ### Motivation diff --git a/.github/ISSUE_TEMPLATE/how-to-question.md b/.github/ISSUE_TEMPLATE/how-to-question.md index dedb19e26c..bf9a228178 100644 --- a/.github/ISSUE_TEMPLATE/how-to-question.md +++ b/.github/ISSUE_TEMPLATE/how-to-question.md @@ -4,14 +4,14 @@ about: Asking how-to questions title: '' labels: question assignees: '' - --- ## ❓ Questions and Help ### Before asking: + 1. search the issues. -2. search the docs. +1. search the docs. @@ -25,6 +25,6 @@ assignees: '' #### What's your environment? - - OS: [e.g. iOS, Linux, Win] - - Packaging [e.g. pip, conda] - - Version [e.g. 0.5.2.1] +- OS: \[e.g. iOS, Linux, Win\] +- Packaging \[e.g. pip, conda\] +- Version \[e.g. 0.5.2.1\] diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md index 8ab9dc9309..795de0c4a7 100644 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -9,21 +9,24 @@ Please include a summary of the change and which issue is fixed. Fixes # (issue) ## Before submitting + - [ ] Was this discussed/approved via a Github issue? (no need for typos and docs improvements) - [ ] Did you read the [contributor guideline](https://github.com/PyTorchLightning/lightning-bolts/blob/master/.github/CONTRIBUTING.md), Pull Request section? - [ ] Did you make sure your PR does only one thing, instead of bundling different changes together? - [ ] Did you make sure to update the documentation with your changes? -- [ ] Did you write any new necessary tests? [not needed for typos/docs] +- [ ] Did you write any new necessary tests? \[not needed for typos/docs\] - [ ] Did you verify new and existing tests pass locally with your changes? - [ ] If you made a notable change (that affects users), did you update the [CHANGELOG](https://github.com/PyTorchLightning/lightning-bolts/blob/master/CHANGELOG.md)? ## PR review - - [ ] Is this pull request ready for review? (if not, please submit in draft mode) + +- [ ] Is this pull request ready for review? (if not, please submit in draft mode) Anyone in the community is free to review the PR once the tests have passed. If we didn't discuss your PR in Github issues there's a high chance it will not be merged. ## Did you have fun? + Make sure you had fun coding 🙃 diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index fbb82810d6..a2195004aa 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -34,6 +34,16 @@ repos: - id: docformatter args: [--in-place, --wrap-summaries=115, --wrap-descriptions=120] + - repo: https://github.com/executablebooks/mdformat + rev: 0.7.7 + hooks: + - id: mdformat + additional_dependencies: + - mdformat-gfm + - mdformat-black + - mdformat_frontmatter + exclude: CHANGELOG.md + - repo: https://github.com/PyCQA/isort rev: 5.9.2 hooks: diff --git a/README.md b/README.md index 0797671bc2..c1523c9ad0 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@ **Pretrained SOTA Deep Learning models, callbacks and more for research and production with PyTorch Lightning and PyTorch** ---- +______________________________________________________________________

Website • @@ -34,18 +34,18 @@ ---- +______________________________________________________________________ ## Continuous Integration

CI testing -| System / PyTorch ver. | 1.6 (min. req.) | 1.8 (latest) | -| :---: | :---: | :---: | -| Linux py3.{6,8} | ![CI full testing](https://github.com/PyTorchLightning/lightning-bolts/workflows/CI%20full%20testing/badge.svg?branch=master&event=push) | ![CI full testing](https://github.com/PyTorchLightning/lightning-bolts/workflows/CI%20full%20testing/badge.svg?branch=master&event=push) | -| OSX py3.{6,8} | ![CI full testing](https://github.com/PyTorchLightning/lightning-bolts/workflows/CI%20full%20testing/badge.svg?branch=master&event=push) | ![CI full testing](https://github.com/PyTorchLightning/lightning-bolts/workflows/CI%20full%20testing/badge.svg?branch=master&event=push) | -| Windows py3.7* | ![CI base testing](https://github.com/PyTorchLightning/lightning-bolts/workflows/CI%20base%20testing/badge.svg?branch=master&event=push) | ![CI base testing](https://github.com/PyTorchLightning/lightning-bolts/workflows/CI%20base%20testing/badge.svg?branch=master&event=push) | +| System / PyTorch ver. | 1.6 (min. req.) | 1.8 (latest) | +| :-------------------: | :--------------------------------------------------------------------------------------------------------------------------------------: | :--------------------------------------------------------------------------------------------------------------------------------------: | +| Linux py3.{6,8} | ![CI full testing](https://github.com/PyTorchLightning/lightning-bolts/workflows/CI%20full%20testing/badge.svg?branch=master&event=push) | ![CI full testing](https://github.com/PyTorchLightning/lightning-bolts/workflows/CI%20full%20testing/badge.svg?branch=master&event=push) | +| OSX py3.{6,8} | ![CI full testing](https://github.com/PyTorchLightning/lightning-bolts/workflows/CI%20full%20testing/badge.svg?branch=master&event=push) | ![CI full testing](https://github.com/PyTorchLightning/lightning-bolts/workflows/CI%20full%20testing/badge.svg?branch=master&event=push) | +| Windows py3.7\* | ![CI base testing](https://github.com/PyTorchLightning/lightning-bolts/workflows/CI%20base%20testing/badge.svg?branch=master&event=push) | ![CI base testing](https://github.com/PyTorchLightning/lightning-bolts/workflows/CI%20base%20testing/badge.svg?branch=master&event=push) | - _\* testing just the package itself, we skip full test suite - excluding `tests` folder_ @@ -57,16 +57,19 @@ View install Simple installation from PyPI + ```bash pip install lightning-bolts ``` Install bleeding-edge (no guarantees) + ```bash pip install git+https://github.com/PytorchLightning/lightning-bolts.git@master --upgrade ``` In case you want to have full experience you can install all optional packages at once + ```bash pip install lightning-bolts["extra"] ``` @@ -91,7 +94,10 @@ The main goal of Bolts is to enable rapid model idea iteration. ```python from pl_bolts.models.self_supervised import SimCLR -from pl_bolts.models.self_supervised.simclr.transforms import SimCLRTrainDataTransform, SimCLREvalDataTransform +from pl_bolts.models.self_supervised.simclr.transforms import ( + SimCLRTrainDataTransform, + SimCLREvalDataTransform, +) import pytorch_lightning as pl # data @@ -99,7 +105,7 @@ train_data = DataLoader(MyDataset(transforms=SimCLRTrainDataTransform(input_heig val_data = DataLoader(MyDataset(transforms=SimCLREvalDataTransform(input_height=32))) # model -weight_path = 'https://pl-bolts-weights.s3.us-east-2.amazonaws.com/simclr/bolts_simclr_imagenet/simclr_imagenet.ckpt' +weight_path = "https://pl-bolts-weights.s3.us-east-2.amazonaws.com/simclr/bolts_simclr_imagenet/simclr_imagenet.ckpt" simclr = SimCLR.load_from_checkpoint(weight_path, strict=False) simclr.freeze() @@ -113,8 +119,8 @@ simclr.freeze() from pl_bolts.models import ImageGPT from pl_bolts.models.self_supervised import SimCLR -class VideoGPT(ImageGPT): +class VideoGPT(ImageGPT): def training_step(self, batch, batch_idx): x, y = batch x = _shape_input(x) @@ -162,7 +168,11 @@ model = LinearRegression(input_dim=13) # try with gpus=4! # trainer = pl.Trainer(gpus=4) trainer = pl.Trainer() -trainer.fit(model, train_dataloader=loaders.train_dataloader(), val_dataloaders=loaders.val_dataloader()) +trainer.fit( + model, + train_dataloader=loaders.train_dataloader(), + val_dataloaders=loaders.val_dataloader(), +) trainer.test(test_dataloaders=loaders.test_dataloader()) ``` @@ -181,14 +191,15 @@ with your implementation. Bolts is supported by the PyTorch Lightning team and the PyTorch Lightning community! ---- +______________________________________________________________________ ## Licence Please observe the Apache 2.0 license that is listed in this repository. - In addition the Lightning framework is Patent Pending. +In addition the Lightning framework is Patent Pending. ## Citation + To cite bolts use: ```