Code Monkey home page Code Monkey logo

mlx-gcn's Introduction

Graph Convolutional Network in MLX

An example of GCN implementation with MLX. Other examples are available here.

The actual benchmark on M1 Pro, M2 Ultra, M3 Max and Tesla V100s is explained in this Medium article.

Install env and requirements

CONDA_SUBDIR=osx-arm64 conda create -n mlx python=3.10 numpy pytorch scipy requests -c conda-forge

conda activate mlx
pip install mlx

Run

To try the model, just run the main.py file. This will download the Cora dataset, run the training and testing. The actual MLX code is located in main.py, whereas the PyTorch equivalent is in main_torch.py.

python main.py

Run benchmark

To run the benchmark on CUDA device, a new env needs to be set up without the CONDA_SUBDIR=osx-arm64 prefix, to be in i386 mode and not arm. For all other experiments on arm and Apple Silicon, just use the env created previously.

python benchmark.py --experiment=[ mlx | torch_mps | torch_cpu | torch_cuda ]

Process benchmark figure

This needs to install additional packages: matplotlib and scikit-learn.

python viz.py

Benchmark of GCN on MLX, MPS, CPU, CUDA

mlx-gcn's People

Contributors

tristanbilot avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

mlx-gcn's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.