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.
Metadata
Release files for pynsm 1.0.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| pynsm-1.0.1.tar.gz | 3.9 MB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| pynsm-1.0.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 3.9 MB
Release files / pynsm-1.0.1.tar.gz
| Download URL | pynsm-1.0.1.tar.gz |
|---|---|
| Size | 3.9 MB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
394ef35ee9d828e792c7682bd9738763dc63d5c704d4f68c8804b29ee079004a
|
|
BLAKE2b-256 checksum How to use checksums |
8ae096f58658aac50f9607089ed75ae7cf7373b5d961aee739a0ec3168475d2f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.9.16
|
Release files / pynsm-1.0.1-py3-none-any.whl
| Download URL | pynsm-1.0.1-py3-none-any.whl |
|---|---|
| Size | 12.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
29c74991acdcacd6d5245e234a6405c534e274e6ce1c11908800cc607177ee3d
|
|
BLAKE2b-256 checksum How to use checksums |
00c63234b3efb6ff2ca4e6a3137c4a7b87d5d80027d6835e46cae9425cbac64d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.9.16
|