Skip to content

twitter/dict_minimize

The Dict Minimize Package

Access scipy optimizers from your favorite deep learning framework.

Installation

Only Python>=3.6 is officially supported, but older versions of Python likely work as well.

The core package itself can be installed with:

To also get the dependencies for all the supported frameworks (torch, JAX, tensorflow) in the README install with

See the GitHub, PyPI, and Read the Docs.

Example Usage

In these examples we optimize a modified Rosenbrock function. However, the arguments have been split into two chunks and stored as two entries in a dictionary. This is to illustrate how this package optimizes dictionaries of (tensor) parameters rather then vectors. We also pass in an extra shift argument to demonstrate how minimize allows extra constant arguments to be passed into the objective.

PyTorch

TensorFlow

NumPy

JAX

Contributing

The following instructions have been tested with Python 3.7.4 on Mac OS (10.14.6).

Install in editable mode

First, define the variables for the paths we will use:

Then clone the repo in your git directory $GIT:

Inside your virtual environments folder $ENVS, make the environment:

Now we can install the pip dependencies. Move back into your git directory and run

Contributor tools

First, we need to setup some needed tools:

To install the pre-commit hooks for contributing run (in the dict_minimize_tools environment):

To rebuild the requirements, we can run:

Generating the documentation

First setup the environment for building with Sphinx:

Then we can do the build:

Documentation will be available in all formats in Makefile. Use make html to only generate the HTML documentation.

Running the tests

The tests for this package can be run with:

The script creates an environment using the requirements found in requirements/test.txt. A code coverage report will also be produced in $GIT/dict_minimize/htmlcov/index.html.

Deployment

The wheel (tar ball) for deployment as a pip installable package can be built using the script:

This script will only run if the git repo is clean, i.e., first run git clean -x -ff -d.

The source is hosted on GitHub.

The documentation is hosted at Read the Docs.

Installable from PyPI.

License

This project is licensed under the Apache 2 License - see the LICENSE file for details.

About

Access scipy optimizers from your favorite deep learning framework.

Topics

Resources

License

Code of conduct

Security policy

Stars

Watchers

Forks

Packages

No packages published