Skip to content

Implementation of various tensor decomposition methods: Spatial, Channel, Tucker, CP, Network Decouple

Notifications You must be signed in to change notification settings

mostafaelhoushi/tensor-decompositions

 
 

Repository files navigation

Tensor Decompositions

This GitHub repo is an extension to https://github.com/jacobgil/pytorch-tensor-decompositions. It provided an implementation to this paper:

@misc{elhoushi2019accelerating,
    title={Accelerating Training using Tensor Decomposition},
    author={Mostafa Elhoushi and Ye Henry Tian and Zihao Chen and Farhan Shafiq and Joey Yiwei Li},
    year={2019},
    eprint={1909.05675},
    archivePrefix={arXiv},
    primaryClass={cs.CV}
}

as well as:

@misc{kim2015compression,
    title={Compression of Deep Convolutional Neural Networks for Fast and Low Power Mobile Applications},
    author={Yong-Deok Kim and Eunhyeok Park and Sungjoo Yoo and Taelim Choi and Lu Yang and Dongjun Shin},
    year={2015},
    eprint={1511.06530},
    archivePrefix={arXiv},
    primaryClass={cs.CV}
}

It provides an implementation of Tucker and CP decomposition of convolutional layers.

It depends on TensorLy for performing tensor decompositions.

Usage

The repo supports training/inference on both CIFAR10 and Imagenet datasets.

The following commands are for Imagenet dataset, if you want to perform the same functionality on CIFAR10, just replace imagenet.py with cifar10.py.

  • Training from scratch
python imagenet.py --arch resnet50

this will train ResNet50 from scratch, saving the model. train log, as well as a checkpoint every 10 epochs in ./models/imagenet/resnet50/no_decompose

  • Decompose a pre-trained model using the approach of Kim et al.:
python imagenet.py --arch resnet50 --pretrained True --decompose --epochs 15 --lr 0.001 --lr-step-size 5
  • Decompose a model that was trained till the 5th epoch:
python imagenet.py --arch resnet50 --weights ./models/imagenet/resnet50/no_decompose/checkpoint_10.pth.tar --decompose --start-epoch 11

Here, we use the checkpoint of trainnig from scratch at the 10th epoch

References

About

Implementation of various tensor decomposition methods: Spatial, Channel, Tucker, CP, Network Decouple

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 100.0%