lessw2020 / Ranger-Deep-Learning-Optimizer

Ranger - a synergistic optimizer using RAdam (Rectified Adam), Gradient Centralization and LookAhead in one codebase
Apache License 2.0
1.19k stars 176 forks source link

Make Ranger a python package #21

Closed mpariente closed 4 years ago

mpariente commented 4 years ago

As discussed in #20, it would be really practical to have these optimizers in a package. This PR makes that possible. ranger can be installed and imported in all python projects, no need to copy paste the ranger optimizer anymore. This also allows to give you proper credit where it is used (I'll add it in the requirements in asteroid for example).

I also updated the README with the install and usage instruction. You can clone the repo, then install it with pip in editable mode (pretty practical for research) or not.

Note : In the __init__.py I imported the three optimizers so that they can be imported from the package directly (from ranger import RangerQH instead of from ranger.rangerqh import RangerQH). Both ranger.py and ranger913A.py had the same name for the class, so I changed the class in ranger913A.py to RangerVA (for versionA).

I'd like to here from you, this would be very practical to have it as a package.

lessw2020 commented 4 years ago

Hi @mpariente, Thanks a ton for this. I just responded on the other thread before seeing this linked in. I'm merging it in now and thanks for fixing the naming collision. :)

mpariente commented 4 years ago

It's a pleasure, thanks to you. Just to be clear, this cannot be installed with pip just yet. In order to pip install ranger, the package needs to be uploaded to PyPI but I added to instructions to install it from git in the README.