Graph Neural Network library made for Apple Silicon
Project description
MLX-graphs
MLX-graphs is a library for Graph Neural Networks (GNNs) built upon Apple's MLX.
Work in progress 🚧
We just started the development of this lib, with the aim to integrate it within ml-explore.
The lib follows the Message Passing Neural Network (MPNN) architecture to build arbitrary GNNs on top of it, similarly as in PyG.
Installation
mlx-graphs
is available on Pypi. To install run
pip install mlx-graphs
Build from source
To build and install mlx-graphs
from source start by cloning the github repo
git clone git@github.com:TristanBilot/mlx-graphs.git && cd mlx-graphs
Create a new virtual environment and install the requirements
pip install -e .
Usage
Graph data model
A graph is defined by a set of (optional) attributes
edge_index
: an array of size[2, num_edges]
which specifies the topology of the graph. The i-th column inedge_index
defines the source and destination nodes of the i-th edgenode_features
: an array of size[num_nodes, num_node_features]
defining the features associated to each node (if any). The i-th row contains the features of the i-th nodeedge_features
: an array of size[num_edges, num_edge_features]
defining the features associated to each edge (if any). The i-th row contains the features of the i-th edgegraph_features
: an array of size[num_graph_features]
defining the features associated to the graph itself
We adopt the above convention across the entire library both in terms of shapes of the attributes and the order in which they're provided to functions.
Contributing
Installing test, dev, benchmaks, docs dependencies
Extra dependencies are specified in the pyproject.toml
.
To install those required for testing, development and building documentation, you can run any of the following
pip install -e '.[test]'
pip install -e '.[dev]'
pip install -e '.[benchmarks]'
pip install -e '.[docs]'
For dev purposes you may want to install the current version of mlx
via pip install mlx @ git+https://github.com/ml-explore/mlx.git
Testing
We encourage to write tests for all components. CI is currently not in place as runners with Apple Silicon are required.
Please run pytest
to ensure breaking changes are not introduced.
Pre-commit hooks (optional)
To ensure code quality you can run pre-commit hooks. Simply install them by running
pre-commit install
and run via pre-commit run --all-files
.
Note: CI is in place to verify code quality, so pull requests that don't meet those requirements won't pass CI tests.
Why running GNNs on my Mac?
By leveraging Apple Silicon, running GNNs enjoys accelerated GPU computation ⚡️ and unified memory architecture. This eliminates device data transfers and enables leveraging all available memory to store large graphs directly on your Mac's GPU.
Why contributing?
We are at an early stage of the development of the lib, which means your contributions can have a large impact! Everyone is welcome to contribute, just open an issue 📝 with your idea 💡 and we'll work together on the implementation ✨.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file mlx-graphs-0.0.2.tar.gz
.
File metadata
- Download URL: mlx-graphs-0.0.2.tar.gz
- Upload date:
- Size: 23.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/4.0.2 CPython/3.11.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 482fca7b41f13d76697cda0b419f096f3229175da0130093cbc895949e87bcbc |
|
MD5 | b7a3fd5bf42f4626e32654736dc28cf8 |
|
BLAKE2b-256 | 207e9f8270b2faa0819b979621208465f52d8cdbb1b0dc0d943950d2b9be78a8 |
File details
Details for the file mlx_graphs-0.0.2-py3-none-any.whl
.
File metadata
- Download URL: mlx_graphs-0.0.2-py3-none-any.whl
- Upload date:
- Size: 28.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/4.0.2 CPython/3.11.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8cc77195705898f806124e9aee836d722472128c21d11b98d8f3f2b056a6b001 |
|
MD5 | e0836337300075a95e238992f3829cd7 |
|
BLAKE2b-256 | a35473e183e0afc40f74fd7127bb2292f4364ad034534ed2861f9326aeb73054 |