Low-rank lottery tickets: finding efficient low-rank neural networks via matrix differential equations
Code supplement for all dense neural network experiments of the arXiv Preprint
- create a python virtual environment (pyenv or conda). If you are using no virtual environment, please be aware of version incompatibilities of tensorflow
- Install the project requirements (example for pip):
pip install -r requirements.txt
- Run the batch scripts for the test cases
sh run_tests_dense_reference.sh
trains a baseline traditional dense network.sh run_tests_fixed_rank.sh
trains a fixed low-rank network using our proposed method. This method is used in section 5.1sh run_tests_rank_adaptive.sh
trains a network using our proposed rank adaptive algorithm to find optimal low rankssh run_tests_fixed_rank_fine_tuning.sh
trains a network using our proposed rank adaptive algorithm to find optimal low ranks. Once the low-ranks are found, the script switches to dynamical fixed rank training to fine-tune the model. This method is used in Section 5.2sh run_tests_fixed_rank_train_from_prune.sh
loads the weights of a traditional network (provided in the folder "dense_weights"), then factorizes the weight matrix and truncates all but 20 eigenvalues. Then, fixed low-rank training is used to retrain the model. This method is used in Section 7.3sh run_test_transformer_dlrt.sh
andsh run_test_transformer_big_dlrt.sh
trains a transformer on the portuguese to english translation task with DLRTsh run_test_transformer_fix_rank.sh
andsh run_test_transformer_big_fix_rank.sh
trains a transformer on the portuguese to english translation task with fixed rank DLRT.
The pytorch version can be found here