Open styler00dollar opened 3 years ago
I managed to fix it by replacing scikit-tensor-py3 calls with tensotly calls. The example works fine now, and I avoided also an ugly numpy&scipy downgrade, which was required by scikit-tensor-py3.
For anyone interested, here is what I did:
Remove from musco/pytorch/compressor/decompositions/tucker2.py any import to scikit-tensor-py3 functions
Add
import tensorly
tensorly.set_backend("pytorch")
in get_tucker_factors the weight line becomes:
weights = tensorly.tensor(self.weight.cpu())
The tucker call changes so that it uses tensorly.decomposition.tucker:
core, (U_cout, U_cin, U_dd) = tensorly.decomposition.tucker(weights, [self.ranks[0], self.ranks[1], weights.shape[-1]], init='nvecs')
Finally few lines down, in the same function, change core = core.dot(U_dd.T)
into core = core.matmul(U_dd.T)
to use pytorch matrix multiplication (.dot works only for 1D vectors).
Like I already mentioned in Issue 13, the demo code seems to crash with an error.
or
The output seems to be random and one of both, if code gets run multiple times.