Skip to content

Commit

Permalink
Merge pull request #21 from mpariente/master
Browse files Browse the repository at this point in the history
Make Ranger a python package
  • Loading branch information
lessw2020 committed Nov 21, 2019
2 parents 7fbbaec + 32b8888 commit 6fde475
Show file tree
Hide file tree
Showing 6 changed files with 35 additions and 2 deletions.
21 changes: 20 additions & 1 deletion README.md
Expand Up @@ -32,7 +32,26 @@ Fixes:
1 - Differential Group learning rates now supported. This was fix in RAdam and ported here thanks to @sholderbach.
2 - save and then load may leave first run weights stranded in memory, slowing down future runs = fixed.


### Installation
Clone the repo, cd into it and install it in editable mode (`-e` option).
That way, these is no more need to re-install the package after modification.
```bash
git clone https://github.com/lessw2020/Ranger-Deep-Learning-Optimizer
cd Ranger-Deep-Learning-Optimizer
pip install -e .
```

### Usage
```python
from ranger import Ranger # this is from ranger.py
from ranger import RangerVA # this is from ranger913A.py
from ranger import RangerQH # this is from rangerqh.py

# Define your model
model = ...
# Each of the Ranger, RangerVA, RangerQH have different parameters.
optimizer = Ranger(model.parameters(), **kwargs)
```
Usage and notebook to test are available here:
https://github.com/lessw2020/Ranger-Mish-ImageWoof-5

Expand Down
3 changes: 3 additions & 0 deletions ranger/__init__.py
@@ -0,0 +1,3 @@
from .ranger import Ranger
from .ranger913A import RangerVA
from .rangerqh import RangerQH
File renamed without changes.
2 changes: 1 addition & 1 deletion ranger913A.py → ranger/ranger913A.py
Expand Up @@ -24,7 +24,7 @@



class Ranger(Optimizer):
class RangerVA(Optimizer):

def __init__(self, params, lr=1e-3, alpha=0.5, k=6, n_sma_threshhold=5, betas=(.95,0.999),
eps=1e-5, weight_decay=0, amsgrad=True, transformer='softplus', smooth=50,
Expand Down
File renamed without changes.
11 changes: 11 additions & 0 deletions setup.py
@@ -0,0 +1,11 @@
from setuptools import setup

setup(
name='ranger',
version='0.0.1',
description='Ranger - a synergistic optimizer using RAdam '
'(Rectified Adam) and LookAhead in one codebase ',
author='Less Wright',
license='Apache',
install_requires=['torch']
)

0 comments on commit 6fde475

Please sign in to comment.