Skip to content

Commit

Permalink
Add CONTRIBUTING.md
Browse files Browse the repository at this point in the history
  • Loading branch information
davidtvs committed Apr 21, 2020
1 parent 9b7b66e commit 6571b9f
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 1 deletion.
32 changes: 32 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# Contributing

All contributions to torch_lr_finder are welcome but make sure you read this first before making a PR.

1. Generally there are two contribution categories:
- Bug-fixing: please search for the issue [here](https://github.com/davidtvs/pytorch-lr-finder/issues) first (including the closed issues). If you cannot find it feel free to create an issue so we can discuss it before making the PR. If there's already an issue, read through the discussion and propose the bug fix there before making the PR.
- New features: making the proposal first as an issue is recommended but you can also go directly for the PR.
2. Write the code in your forked repository. Consider the following:
1. Please follow the instruction in [Development setup](#development-setup).
2. Make sure any class or function you create or change has proper docstrings. Look at the existing code for examples on how they are formatted.
3. Write tests.
4. Run the tests locally and make sure everything is passing.
5. Try your best not to introduce more flake8 warnings.
3. Use descriptive commit messages.
4. Submit your PR.


## Development setup

A virtual environment or other forms of environment isolation are highly recommended before you continue.

- Installing pytorch-lr-finder in development mode:
```sh
pip install -e .[dev]
```
Note that the command above will also install all the required dependencies.
- To run the tests, run the following command from the root directory of the repository or within the `tests` folder:
```sh
pytest
```
- Use black to automatically format your code - if you need help, check the documentation in [black's github repository](https://github.com/psf/black).
- Use flake8 to lint your code - if you need help, check [flake8's documentation](https://flake8.pycqa.org/en/latest/index.html).
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -116,3 +116,7 @@ lr_finder.reset()
Note that the benefit of mixed precision training requires a nvidia GPU with tensor cores (see also: [NVIDIA/apex #297](https://github.com/NVIDIA/apex/issues/297))

Besides, you can try to set `torch.backends.cudnn.benchmark = True` to improve the training speed. (but it won't work for some cases, you should use it at your own risk)

## Contributing and pull requests

All contributions are welcome but first, have a look at [CONTRIBUTING.md](CONTRIBUTING.md).
2 changes: 1 addition & 1 deletion torch_lr_finder/lr_finder.py
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,7 @@ def _train_batch(self, iter_wrapper, accumulation_steps):

def _move_to_device(self, inputs, labels):
def move(obj, device):
if hasattr(obj, 'to'):
if hasattr(obj, "to"):
return obj.to(device)
elif isinstance(obj, tuple):
return tuple(move(o, device) for o in obj)
Expand Down

0 comments on commit 6571b9f

Please sign in to comment.