Skip to main content

Greenformer

Automatic factorization library for pytorch

License: MIT

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!

Metadata

Release files for greenformer 0.2.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for greenformer 0.2.2
File Size Uploaded Provenance Actions
greenformer-0.2.2.tar.gz 7.1 kB Without provenance Details for greenformer-0.2.2.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for greenformer 0.2.2
File Interpreter ABI Platform Actions
greenformer-0.2.2-py3-none-any.whl Python 3 none any Details for greenformer-0.2.2-py3-none-any.whl

Total release size: 13.7 kB

Release files / greenformer-0.2.2.tar.gz

Download URL greenformer-0.2.2.tar.gz
Size 7.1 kB
Tags Source
SHA-256 checksum
How to use checksums
18ff08afdf72dd8d6172d7f15785a89630a1c6286c6c7a4fe9705f31ac5d0434
BLAKE2b-256 checksum
How to use checksums
2eeb96093f3213eb097794757d522ab32c70f7acd5bb8a23da0349a8faae35b4
Upload date
Uploaded using Trusted Publishing?
What is 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

Release files / greenformer-0.2.2-py3-none-any.whl

Download URL greenformer-0.2.2-py3-none-any.whl
Size 6.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
84eba035229d20ade12abfc17911360413f77c960d040e35f98d36816e7064d6
BLAKE2b-256 checksum
How to use checksums
99440a2bd8d8697625406a70b6b0ddfc0e7c3a5987ac55121da3ac672af0a496
Upload date
Uploaded using Trusted Publishing?
What is 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

Security for greenformer 0.2.2

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page