Installation#

The package requires Python 3.12 or newer. The installation of motulator and its dependencies is described in the documentation of motulator; motulator and PyTorch are installed automatically as dependencies of this package. The package supports motulator 0.15 and 0.16, and the support is extended after each new release of motulator has been tested.

The PyTorch wheels on PyPI for Linux include CUDA support and are large. The small networks of this package are trained in a reasonable time on a CPU, so a CPU-only build is sufficient. It is installed before the package with the command:

pip install --index-url https://download.pytorch.org/whl/cpu torch

Option 1: Use pip#

The simplest way to install the package is to use pip:

pip install motulator-gradnet

Note

Instead of global installation described above, using a virtual environment is generally recommended.

Option 2: Clone the Repository#

For developers and advanced users, cloning the repository is recommended. The following instructions are for VS Code:

  1. Install VS Code, Python, and git on your computer. Install also the recommended extensions in VS Code.

  2. Clone the project using the command:

    git clone https://github.com/Aalto-Electric-Drives/motulator-gradnet
    
  3. Launch VS Code from the cloned project’s root directory.

  4. Create a virtual environment in the workspace.

  5. Install the package with its optional dependencies in the VS Code terminal, after the virtual environment is created and activated:

    pip install -e .[dev,doc]
    

    The dev dependencies are needed for the tests and the code checks and the doc dependencies for building this documentation.

  6. Now you can run the example scripts in the examples/ folder.

The tests are run with pytest and the documentation is built with the command:

sphinx-build -b html docs/source docs/build/html