Skip to content

Commit

Permalink
Merge branch 'master' into feature/596-sac
Browse files Browse the repository at this point in the history
  • Loading branch information
mergify[bot] authored Aug 19, 2021
2 parents 25aa7e0 + 47eb2aa commit c6104c0
Show file tree
Hide file tree
Showing 8 changed files with 75 additions and 52 deletions.
31 changes: 16 additions & 15 deletions .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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).

Expand All @@ -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.

Expand All @@ -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

Expand All @@ -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 `<type>/<issue-id>_<short-name>` 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.
25 changes: 12 additions & 13 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ about: Create a report to help us improve
title: ''
labels: bug / fix, help wanted
assignees: ''

---

## 🐛 Bug
Expand All @@ -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

<!-- If you have a code sample, error messages, stack traces, please provide it here as well -->


#### Code sample

<!-- Ideally attach a minimal code sample to reproduce the decried issue.
Minimal means having the shortest code but still preserving the bug. -->

Expand All @@ -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

Expand Down
5 changes: 2 additions & 3 deletions .github/ISSUE_TEMPLATE/documentation.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,14 @@ about: Typos and doc fixes
title: ''
labels: documentation
assignees: ''

---

## 📚 Documentation

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!
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/feature_request.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ about: Suggest an idea for this project
title: ''
labels: enhancement, help wanted
assignees: ''

---

## 🚀 Feature

<!-- A clear and concise description of the feature proposal -->

### Motivation
Expand Down
10 changes: 5 additions & 5 deletions .github/ISSUE_TEMPLATE/how-to-question.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.

<!-- If you still can't find what you need: -->

Expand All @@ -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\]
7 changes: 5 additions & 2 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)?

<!-- For CHANGELOG separate each item in unreleased section by a blank line to reduce collisions -->

## 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 🙃
10 changes: 10 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
37 changes: 24 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

**Pretrained SOTA Deep Learning models, callbacks and more for research and production with PyTorch Lightning and PyTorch**

---
______________________________________________________________________

<p align="center">
<a href="https://www.pytorchlightning.ai/">Website</a> •
Expand Down Expand Up @@ -34,18 +34,18 @@

</div>

---
______________________________________________________________________

## Continuous Integration

<details>
<summary>CI testing</summary>

| 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_

Expand All @@ -57,16 +57,19 @@
<summary>View install</summary>

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"]
```
Expand All @@ -91,15 +94,18 @@ 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
train_data = DataLoader(MyDataset(transforms=SimCLRTrainDataTransform(input_height=32)))
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()
Expand All @@ -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)
Expand Down Expand Up @@ -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())
```

Expand All @@ -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:

```
Expand Down

0 comments on commit c6104c0

Please sign in to comment.