musco-ai / musco-pytorch Goto Github PK
View Code? Open in Web Editor NEWMUSCO: MUlti-Stage COmpression of neural networks
License: BSD 3-Clause "New" or "Revised" License
MUSCO: MUlti-Stage COmpression of neural networks
License: BSD 3-Clause "New" or "Revised" License
Relying on copy.deepcopy to copy the model in:
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)
Hello , have you ever tried to compress not only backbone but also FPN ?
when I run the compressed VGG16 model, the runtime is even longer than VGG16 before compressed. how to run the compressed models getting the same results (Table 5) in the paper https://arxiv.org/abs/1903.09973?
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!
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.
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
Recently, Pip changed its internal implementation.
So in the last pip versions, I met error with setup.py
it can be debugged by replacing
return [str(item.req) for item in requirements]
by
try:
return [str(item.req) for item in requirements]
except:
return [str(item.requirement) for item in requirements]
for compatible with both the versions.
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.*.
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
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.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.