A PyTorch implementation of non-negative similarity matching
Project description
Non-negative similarity matching in PyTorch
This is an implementation of non-negative similarity matching (NSM) for PyTorch focusing on ease of use, extensibility, and speed.
Getting started
You can install the package from PyPI by using
pip install pynsm
User documentation
Find examples, how-to guides, tutorials, and full API reference information on Readthedocs, https://pynsm.readthedocs.io/.
Questions or issues?
Please contact us by opening an issue on GitHub.
Instructions for developers
Developer installation
It is strongly recommended to use a virtual environment when working with this code. The installation instructions below include the commands for creating the virtual environment, using either conda
(recommended) or venv
.
Developer install using conda
If you do not have conda
installed, the easiest way to get started is with Miniconda. Follow the installation instructions for your system.
Next, create a new environment and install for CPU using
conda env create -f environment.yml
For using an NVIDIA GPU run
conda env create -f environment-cuda.yml
Note that most Macs do not have an NVIDIA GPU, so you should use the first invocation shown above. If your Mac uses the newer Apple chips, you may be able to use device=mps
to get GPU acceleration (the installation procedure remains unchanged).
The commands above automatically perform an "editable" install—this means that changes made to the code will automatically take effect without having to reinstall the package.
Developer install using venv
Before creating a new virtual environment, it is best to ensure you're not using the system version of Python—this is often badly out of date. Some options for doing this are outlined in The Hitchhiker's Guide to Python, although many options exist. One advantage of using conda
is that this is done for you.
Once you have a proper Python install, create a new virtual environment by running the following command in a terminal inside the main folder of the repository:
python -m venv env
This creates a subfolder called env
containing the files for the virtual environment. Next we need to activate the environment and install the package with its pre-requisites:
source env/bin/activate
pip install -e ".[dev]"
The -e
marks this as an "editable" install—this means that changes made to the code will automatically take effect without having to reinstall the package.
Example usage
See the notebooks in the examples
folder to get started with the package. The information on readthedocs may also prove useful.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.