Giter Club home page Giter Club logo

ddopai's Introduction

DDOPaI

This is the implementation of the paper: "Leveraging Discriminative Data: A Pathway to High-Performance, Stable One-shot Network Pruning at Initialization"

Step 0. File and Data Structure

  • ..
    • data
      • imagenet
        • train
        • val
      • tiny_imagenet
        • train
        • val
    • DDOPaI
      • tmp # Generated Discriminative Data is here.

Step 1. Extract Discriminative Data

Extract Discriminative Data using extractdd.py with TensorFlow, as in the ACE implementation. The environment is created using Docker to manage package versions. The Docker build command lines are as follows:

cd env
docker rm --force extractdd
docker-compose build
docker-compose up -d

After the container is set up, the following command line extracts Discriminative Data from a pre-trained Resnet-50:

python extracdd.py --teacher_model resnet50

We are pleased to provide discriminative data samples extracted from a pre-trained ResNet-50 using ImageNet-1k. However, due to ImageNet's data policy, we cannot offer these samples directly. If users need access to these discriminative data, please contact the authors. We will provide a cloud download link to facilitate access.

Step 1.5. Stitching Concepts

The stitching_concept.ipynb notebook provides a demo to stitch concepts into a stitching image patch.

Step 2. Pruning with Discrimnative Data

The pruning method implementations are from: https://github.com/alecwangcq/GraSP https://github.com/JingtongSu/sanity-checking-pruning/

conda create -n DDOPaI python=3.8
conda activate DDOPaI
conda install pytorch torchvision torchaudio pytorch-cuda=12.1 -c pytorch -c nvidia
pip install matplotlib
pip install tqdm
pip install tensorboardX
pip install easydict
pip install einops
pip install scikit-learn
pip install scikit-image

The pruning experiments of resent50 on Imagenet is:

python main_finetune_imagenet.py --config configs/imagenet/resnet50/SNIP_DD_60.json

DD is for Discriminative Data-based Pruning. SD is for Stitching Data-based Pruning.

The fine-tune process is:

python main_finetune_imagenet.py --resume_pruned <your_pruned_model_path>

Ablations on Data

In the results/ablation directory, we provide two implementation notebooks corresponding to the data quality ablation experiments presented in our paper (Figure 6). By altering the brightness of input images, we examine the impact of data quality changes on pruning methods.

PyTorch implementation and Swin-Transformer experiment.

In the ACE/pytorch directory, we offer a PyTorch ACE implementation available from this repository. https://github.com/amiratag/ACE

The main_vit_cifar10.py script demonstrates pruning experiments on the Swin-Transformer model using the CIFAR-10 dataset.

ddopai's People

Contributors

nonac avatar

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.