Git Product home page Git Product logo

pytorch-pruning-2step's Introduction

Train & Pruning with PyTorch

by hou-yz, based on kuangliu/pytorch-cifar

improve inference speed and reduce intermediate feature sizes to favor distributed inference (local device compute half of the model and upload the feature for further computing on stronger devices or cloud).

  • pruning stage-1: prune the whole model to increase inference speed and slightly reduce intermediate feature sizes.

  • pruning stage-2: (based on step-1's model) for each split-point (where the intermediate feature is transferred to another device for further computation), specifically prune the layer just before the split-point to reduce intermediate feature sizes even more.

only support python3 with pytorch > 0.3.1; model trained on cifar-10, tested only on vgg-16.

also added auto-logging and auto chart-drawing.

usage

training:

python main.py --train          # train from scratch
python main.py --resume         # resume training

2-step pruning:

first, in step-1, you can prune the whole model by

python main.py --prune          # prune the whole model

once you finished step-1, you can then prune each layer (step-2) individually for minimum bandwidth requirement with

python main.py --prune_layer    # prune layers and save models separately

chart drawing:

for logging and excel chart drawing, try

python maim.py --test_pruned    # test the pruned model and save *.json logs
python draw_chart.py

which automatically generate the chart.xlsx file.

updates

  • added pruning features;
  • added 2-stage pruning method: --prune & --prune_layer
  • added draw_chart with openpyxl (open in excel);
  • added cpu-only support and windows support.

pytorch-pruning-2step's People

Contributors

bearpaw avatar fducau avatar hou-yz avatar ypwhs avatar

Stargazers

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

Watchers

 avatar  avatar

pytorch-pruning-2step's Issues

数据一样,绘制的图片不同

您好,请问您论文中的在不同计算比 r 情况下的端到端延迟的那张图。是如何绘制的呢?尤其是横坐标的设置。以及根据您论文中的公式。得出 :End to End lantency = (r +1) 服务器端延迟+传输工作量/R 是否正确?

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.