Installation

This page will walk you through installing Keras-MML.

Requirements

Keras-MML has a few requirements, namely

Instructions on how to install Keras can be found here.

Installation Instructions

PyPi

If you use pip, you can install Keras-MML using the command

pip install keras-matmulless

Pre-Release Versions

To install pre-release versions, use the command

pip install --pre keras-matmulless

Nightly Versions

Nightly releases for Keras-MML are primarily found on the TestPyPi page. To install them, use the command

pip install -i https://test.pypi.org/simple/ keras-matmulless

Building From Scratch

First, clone the repository using

git clone https://github.com/PhotonicGluon/Keras-MatMulLess.git
cd Keras-MatMulLess

We recommend to create a virtual environment to install Poetry and the other dependencies into.

python -m venv venv  # If `python` doesn't work, try `python3`

Activate the virtual environment using

source venv/bin/activate

or, if you are on Windows,

venv/Scripts/activate

Now we install Poetry.

pip install poetry

Finally, install the development dependencies. The development dependencies are split into several groups.

  • The test group contains dependencies that are used to perform testing.

  • The docs group contains dependencies that are used to generate the documentation.

  • The build group contains dependencies that are used to create a distributable.

  • The notebook group is required to run the Jupyter notebooks in the documentation folder.

Simply include the desired groups in the install.py call. For example, to install test, docs, and build (the main development dependencies), run the following command.

python install.py test docs build

If you have not installed a backend (i.e., Tensorflow, PyTorch, or Jax) you can do so here.

python install.py test docs build --backend BACKEND_NAME

Note that the BACKEND_NAME to be specified here is

  • tensorflow for the Tensorflow backend;

  • torch for the PyTorch backend; and

  • jax for the Jax backend.

If you need to install with CUDA support, run

python install.py test docs build --backend BACKEND_NAME --with-cuda

That’s it! You should now have access to the keras_mml package.