Giter Club home page Giter Club logo

deep-compression-pytorch's People

Stargazers

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

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

deep-compression-pytorch's Issues

AttributeError: 'ReLU' object has no attribute 'weight'

Hello, mightydeveloper.
When I use 'weight_share.py' to compress the trained model, the error occured:
AttributeError: 'ReLU' object has no attribute 'weight' .
File "weight_share.py", line 32, in
apply_weight_sharing(model)
File "/net/quantization.py", line 16, in apply_weight_sharing
dev = module.weight.device
File "/usr/local/lib/python3.5/dist-packages/torch/nn/modules/module.py", line 539, in getattr
type(self).name, name))
AttributeError: 'ReLU' object has no attribute 'weight'
How to jump over the ReLU module?
THANKS.

pytorch version

Could you please mention the pytorch version this repo supports.?

dimension error

i try weight sharing and huffman encode for yolov7 but it both have error:

TypeError:** expected dimension <= 2 array or matrix

Turn out coo matrix in scipy only support weight maxtrix with shape <=2. So it not flexible. Any fix for that ???.Thank you

running bug:

When i run the pruning.py, the following bug was raised, what's the possible problem?
RuntimeError:
An attempt has been made to start a new process before the
current process has finished its bootstrapping phase.

    This probably means that you are not using fork to start your
    child processes and you have forgotten to use the proper idiom
    in the main module:

        if __name__ == '__main__':
            freeze_support()
            ...

    The "freeze_support()" line can be omitted if the program
    is not going to be frozen to produce an executable.

problem in dataloader

when the num_worker of Dataloader is not zero, there would be an error. some people say it is because the multi-threads of windows is accomplished with spawn instead of fork. I am not familiar with computer science, could you please tell me what should I do to avoid this error while still getting the benifits of multi-threads?

some problem in quantization

@mightydeveloper Hi, I used the quantization script in my model .Because of the existing of convolution layer,I encountered an error named as "TypeError: expected dimension <= 2 array or matrix" in using csc_matrix . How to fix the problem? can you give me some advice ? Thank you!

Model Size Problem

Why after i use the three way, the model size is same of the three: @mightydeveloper

-rw-r--r--. 1 root root 2.1M Oct 10 02:17 initial_model.ptmodel
-rw-r--r--. 1 root root 2.1M Oct 10 02:46 model_after_retraining.ptmodel
-rw-r--r--. 1 root root 2.1M Oct 10 03:04 model_after_weight_sharing.ptmodel

Using Deep-Compression in MobileNet-V2

When I use your`s Deep compression functin in MobileNet-V2 Model,I find some problem,

  1. I need use kmeans in every weight among Layer, but the weight is different dimensions
  2. When i use prune in MobileNet , I should use prune in every fc layer?
    @mightydeveloper

Why after huffman_encode, why the parameters increase?

after prune the all parameter is 112422,when use huffman_encode,in change to 899388?? @mightydeveloper

--- After Retraining ---
fc1.weight           | nonzeros =  107208 /  235200 ( 45.58%) | total_pruned =  127992 | shape = (300, 784)
fc1.bias             | nonzeros =     300 /     300 (100.00%) | total_pruned =       0 | shape = (300,)
fc2.weight           | nonzeros =    4338 /   30000 ( 14.46%) | total_pruned =   25662 | shape = (100, 300)
fc2.bias             | nonzeros =     100 /     100 (100.00%) | total_pruned =       0 | shape = (100,)
fc3.weight           | nonzeros =     466 /    1000 ( 46.60%) | total_pruned =     534 | shape = (10, 100)
fc3.bias             | nonzeros =      10 /      10 (100.00%) | total_pruned =       0 | shape = (10,)
alive: 112422, pruned : 154188, total: 266610, Compression rate :       2.37x  ( 57.83% pruned)

Layer           |   original compressed improvement percent
----------------------------------------------------------------------
fc1.weight      |     858868     176999       4.85x  20.61%
fc1.bias        |       1200       1200       1.00x 100.00%
fc2.weight      |      35108       7696       4.56x  21.92%
fc2.bias        |        400        400       1.00x 100.00%
fc3.weight      |       3772       1102       3.42x  29.22%
fc3.bias        |         40         40       1.00x 100.00%
----------------------------------------------------------------------
total           |     899388     187437       4.80x  20.84%

Using LeNet5

I'm Trying to apply the whole compression process on LeNet5 instead of LeNet300-100
I Fixed some problems I Encountered but now in the quantization step, I can't use sparse matrices because the shape of the first layer for example is considered with the kernel size, so I'm facing the following error:
TypeError: expected dimension <= 2 array or matrix
Is there a way to fix this problem?

weight_shared.py run false

Please tell me what should I do if I get the error KMeans.init() got an unexpected keyword argument 'precompute_distances' when I run weight_shared.py?

Custom architecture

@mightydeveloper hi thanks for the wonderful code base , i have following few queries
1.Can we reduce the weight size of the model with the following code base
2. can your code base be applied to custom architecture

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.