Automatic Factorization package for PyTorch modules
Project description
Greenformer
Automatic factorization library for pytorch
If you use any source codes included in this toolkit in your work, please cite the following paper.
- Winata, G. I., Cahyawijaya, S., Lin, Z., Liu, Z., & Fung, P. (2020, May). Lightweight and efficient end-to-end speech recognition using low-rank transformer. In ICASSP 2020-2020 IEEE International Conference on Acoustics, Speech and Signal Processing (ICASSP) (pp. 6144-6148). IEEE.
What is Greenformer
Greenformer is a library to convert Linear, Conv1d, Conv2d, Conv3d layers into its own variant which called LED.
Greenformer seeks over your PyTorch module, replace all Linear layers into LED layers and all Conv1d, Conv2d, Conv3d layers into CED layers with the specified rank.
How to Install
pip install greenformer
Usage
BERT Model
from transformers import BertModel, BertConfig
from greenformer import auto_fact
config = BertConfig.from_pretrained('bert-base-uncased', pretrained=False)
model = BertModel(config=config)
model = auto_fact(model, rank=100, deepcopy=False, ignore_lower_equal_dim=True, fact_led_unit=False)
VGG Model
import torch
from torchvision import models
from greenformer import auto_fact
model = models.vgg16()
model = auto_fact(model, rank=64, deepcopy=False, ignore_lower_equal_dim=True, fact_led_unit=False)
Why Use GreenFormer
- Improve the speed of you model significantly, check our Example Notebook
- Mantain model performance with appropriate choice of rank, check our ICASSP 2020 Paper
- Easy to use and works on any kind of model!
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file greenformer-0.2.2.tar.gz.
File metadata
- Download URL: greenformer-0.2.2.tar.gz
- Upload date:
- Size: 7.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.49.0 CPython/3.8.11
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
18ff08afdf72dd8d6172d7f15785a89630a1c6286c6c7a4fe9705f31ac5d0434
|
|
| MD5 |
e9dca43b1db72267e051a8c501e787a8
|
|
| BLAKE2b-256 |
2eeb96093f3213eb097794757d522ab32c70f7acd5bb8a23da0349a8faae35b4
|
File details
Details for the file greenformer-0.2.2-py3-none-any.whl.
File metadata
- Download URL: greenformer-0.2.2-py3-none-any.whl
- Upload date:
- Size: 6.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.49.0 CPython/3.8.11
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
84eba035229d20ade12abfc17911360413f77c960d040e35f98d36816e7064d6
|
|
| MD5 |
428a6bc2e654f482a86387044586da10
|
|
| BLAKE2b-256 |
99440a2bd8d8697625406a70b6b0ddfc0e7c3a5987ac55121da3ac672af0a496
|