musco-pytorch
musco-pytorch copied to clipboard
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 https://github.com/musco-ai/musco-pytorch/commit/6e4c9477efa330c5b679a482efe912e43f7c8a06
hi everybody! can anyone fix it? doesn't seem like a big issue more like a bug.
https://github.com/musco-ai/musco-pytorch/blob/master/musco/pytorch/compressor/decompositions/svd_layer.py#L168 looks like out_features/in_features should be considered too....
any fix?
Hi @aupuzikov and @aswanthkrishna, thank you for noticing this bug! Now it is fixed
thanks a lot :)
It seems not to be fixed if it gets installed with pip. I still have:
~/anaconda3/lib/python3.8/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'
I used musco-pytorch 1.0.6. Solution:
pip uninstall musco-pytorch -y
git clone https://github.com/musco-ai/musco-pytorch
cd musco-pytorch
python setup.py install
This results in:
~/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
Which would be a new issue though, but I thought I at least mention it. The output seems random. Used code from Github readme.