Giter VIP home page Giter VIP logo

amazon-science / mlp-rank-pruning Goto Github PK

View Code? Open in Web Editor NEW
2.0 2.0 1.0 62 KB

MLP-Rank: A graph theoretical approach to structured pruning of deep neural networks based on weighted Page Rank centrality as introduced by the related thesis.

License: Apache License 2.0

Python 100.00%
centrality-measures graph-theory inference-optimization machine-learning multilayer-perceptron neural-network pagerank pruning structured-sparsity weighted-pagerank

mlp-rank-pruning's Introduction

MLP-Rank: A Graph Theoretical Approach to Pruning Deep Neural Networks

This is the PyTorch implementation of pruning neural networks based on the weighted PageRank centrality measure as introduced by my thesis:

MLP-Rank: A Graph Theoretical Approach to Pruning Deep Neural Networks
Amazon Web Services - AI Research and Education
Author: David B. Hoffmann
Advisor: Dr. Kailash Budhathoki, Dr. Matthäus Kleindessner \

@mastersthesis{hoffmann2024mlprank,
    type={Bachelor's Thesis},
    title={MLP-Rank: A Graph Theoretical Approach to Pruning Deep Neural Networks},
    author={Hoffmann, David B.},
    year={2024},
}

Setup

To setup mlp-rank-pruning, clone the repository and install it locally with pip install -e ..

How To Use

The package provides everything needed to train and prune mulilayer perceptron networks as done in the thesis. It contains a training module which can be used to conduct distributed hyperparameter optimisation over a simple grid as well as training of single MLP model, for image classification tasks. For further documentation related to training refer to the training README. Note that the code in the training folder is subject to a separate license, which is provided in that folder.
The mlprank package contains everything related to pruning a pretrained neural network. It is designed to be easily extendible and compatible with further methods and scoring functions for structured pruning to allow for other comparisons, which is further detailed in the architecture README. The core function of the mlprank package is prune_mlp, which is documented in the mlprank README. To do structured pruning using weighted PageRank centrality on a simple three layer MLP using MNIST as calibration data, the following code can be used:

from mlprank import prune_mlp

metrics, scores = prune_mlp(
    model_name="TwoLayerMLP",
    dataset_name="MNIST",
    method_name="Local",
    measure_name="WeightedPageRank",
    amount=0.3,
    out_path="."
)

The experiment module acts as a CLI tool for running multiple experiments. It takes a list of fixed and iterable arguments for different networks, scoring functions, pruning methods and pruning amounts and calls the mlprank.prune_mlp method. For more details refer to the experiment README.

Security

See CONTRIBUTING for more information.

License

This project is licensed under the Apache-2.0 License.

mlp-rank-pruning's People

Contributors

amazon-auto avatar adavidho avatar

Stargazers

SeshurajuP avatar  avatar

Watchers

Osama Makansi avatar Kostas Georgiou avatar

Forkers

adavidho

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.