GithubHelp home page GithubHelp logo

musco-ai / musco-pytorch Goto Github PK

View Code? Open in Web Editor NEW
73.0 9.0 16.0 697 KB

MUSCO: MUlti-Stage COmpression of neural networks

License: BSD 3-Clause "New" or "Revised" License

Python 32.69% Jupyter Notebook 67.31%
pytorch network-compression tensor-decomposition tucker cp-decomposition truncated-svd vbmf low-rank deep-neural-networks network-acceleration

musco-pytorch's People

Contributors

dirtmaxim avatar juliagusak avatar narumiruna avatar wetzlerdenis avatar

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

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

musco-pytorch's Issues

copy.deepcopy does not work on Faster R-CNN models

Relying on copy.deepcopy to copy the model in:

  • compression_conf_fc.ipynb
  • compress.py

Does not work for Faster R-CNN models which use mixed serialization & non-script modules.

This results in the error: _pickle.PickleError: ScriptModules cannot be saved using torch.save. Mixed serialization of script and non-script modules is not supported. For purely script modules use my_script_module.save(<filename>) instead.

Refer to PyTorch issue 18106.

What Faster R-CNN Resnet50 model were you using for this to work? I have been trying with the torchvision pretrained model with no success: torchvision.models.detection.fasterrcnn_resnet50_fpn(pretrained=True)

Request for ResNet-18 model

Hi,
could ResNet-18 on ILSVRC-12 validation dataset in 6.2 of your paper be released, which experience only 0.47 percent top-1 accuracy drop while achieving 2.42 flops reduction.

Installation fails due to conflicting numpy version

Hi, users are unable to run musco-pytorch due to dependency conflict with numpy package. As shown in the following full dependency graph of musco-pytorch, musco-pytorch requires numpy *,while scikit-tensor-py3 requires numpy ==1.16.*.

According to pip’s “first found wins” installation strategy, numpy 1.17.4 is the actually installed version. However, numpy 1.17.4 does not satisfy ==1.16.*.

Dependency tree-----------

musco-pytorch - 1.0.3
| +- absl-py(install version:0.8.1 version range:*)
| +- flopco-pytorch(install version:0.1.3 version range:*)
| +- numpy(install version:1.17.4 version range:*)
| +- scikit-tensor-py3(install version:0.4.1 version range:*)
| | +- numpy(install version:1.16.5 version range:==1.16.*)
| | +- scipy(install version:1.3.3 version range:==1.3.)
| +- scipy(install version:1.3.3 version range:*)
| +- tensorly-musco(install version:0.4.5 version range:*)

Thanks for your help.
Best,
Neolith

FPN

Hello , have you ever tried to compress not only backbone but also FPN ?

How to restore the ideal accuracy(mAP) by fine-tuning

Hi author! Thx for ur sharing!

I was just trying your iterative compression algorithms using vbmf for compressing the faster rcnn model (exactly the same code mentioned in your paper), but i found it great difficulty doing the fine-tuning work. The more layers I compressed, the less mAP it achieved. Finally, it is approximately 8~10 points lost, which is far below your performance.

Can u tell me how I should do the fine-tuning part better? (like dataset, lr, epoch, etc.) Or can u tell me some of your opinions in terms of it? Thank u!

Running demo code results in "LinAlgError: SVD did not converge" or "ValueError: array must not contain infs or NaNs"

Like I already mentioned in Issue 13, the demo code seems to crash with an error.

from torchvision.models import resnet50
from flopco import FlopCo
from musco.pytorch import CompressorVBMF, CompressorPR, CompressorManual

model = resnet50(pretrained = True)
model.cuda()
model_stats = FlopCo(model, device = 'cuda')

compressor = CompressorVBMF(model,
                            model_stats,
                            ft_every=5, 
                            nglobal_compress_iters=2)
while not compressor.done:
    compressor.compression_step()
compressed_model = compressor.compressed_model
~/anaconda3/lib/python3.8/site-packages/numpy/linalg/linalg.py in _raise_linalgerror_svd_nonconvergence(err, flag)
    104 
    105 def _raise_linalgerror_svd_nonconvergence(err, flag):
--> 106     raise LinAlgError("SVD did not converge")
    107 
    108 def _raise_linalgerror_lstsq(err, flag):

LinAlgError: SVD did not converge

or

~/anaconda3/lib/python3.8/site-packages/numpy/lib/function_base.py in asarray_chkfinite(a, dtype, order)
    495     a = asarray(a, dtype=dtype, order=order)
    496     if a.dtype.char in typecodes['AllFloat'] and not np.isfinite(a).all():
--> 497         raise ValueError(
    498             "array must not contain infs or NaNs")
    499     return a

ValueError: array must not contain infs or NaNs

The output seems to be random and one of both, if code gets run multiple times.

resnet18: AttributeError: 'SVDDecomposedConvLayer' object has no attribute 'min_rank'

I've tried to compress my resnet18 and failed. SVDDecomposedConvLayer has no min_rank field. I'm getting exception.

Anaconda3\envs\musco\lib\site-packages\musco\pytorch\compressor\decompositions\svd_layer.py in __init__(self, layer, layer_name, rank_selection, rank, pretrained, vbmf_weaken_factor, param_reduction_rate)
    157 
    158         if rank_selection == 'vbmf':
--> 159             self.rank = estimate_vbmf_ranks(self.weight, vbmf_weaken_factor, min_rank = self.min_rank)
    160         elif rank_selection == 'manual':
    161             self.rank = rank

AttributeError: 'SVDDecomposedConvLayer' object has no attribute 'min_rank'

because of 6e4c947

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.