Skip to main content

Graph Neural Network library made for Apple Silicon

Project description

MLX-graphs

Documentation

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 (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

  1. edge_index: an array of size [2, num_edges] which specifies the topology of the graph. The i-th column in edge_index defines the source and destination nodes of the i-th edge
  2. node_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 node
  3. edge_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 edge
  4. graph_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

mlx-graphs-0.0.1.tar.gz (23.1 kB view details)

Uploaded Source

Built Distribution

mlx_graphs-0.0.1-py3-none-any.whl (28.9 kB view details)

Uploaded Python 3

File details

Details for the file mlx-graphs-0.0.1.tar.gz.

File metadata

  • Download URL: mlx-graphs-0.0.1.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

Hashes for mlx-graphs-0.0.1.tar.gz
Algorithm Hash digest
SHA256 abed18f2f54811848e2c0b5b00f0e0f69b8156e579760ae270f73df419dfded8
MD5 7c00aec0cf8e6179fa0304eea6a9f8c8
BLAKE2b-256 89dc89116c4d6c1705065b1b05281eade7b95bec7a3be5a8419f7f7adbe24e31

See more details on using hashes here.

File details

Details for the file mlx_graphs-0.0.1-py3-none-any.whl.

File metadata

  • Download URL: mlx_graphs-0.0.1-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

Hashes for mlx_graphs-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 26c43385b7c21109e1432ebd1ad6a6e2c6fb3c2dd67748890c8b39ad4cd8d2a7
MD5 7bc1a80815662c98e054132ce1e934a8
BLAKE2b-256 0adc848f44facb56fb5856e86a75f8298719eeb841274783f9c83295e2f58d85

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page