PyTorch toolkit for pruning pre-trained language models
Top 75.2% on sourcepulse
TextPruner is a PyTorch-based toolkit for efficiently reducing the size and inference time of pre-trained language models. It offers training-free, structured pruning methods for researchers and practitioners looking to deploy large NLP models in resource-constrained environments.
How It Works
TextPruner implements two primary pruning strategies: vocabulary pruning and transformer pruning. Vocabulary pruning removes underutilized tokens from the model's embedding layer and tokenizer, reducing model size and potentially speeding up masked language modeling tasks. Transformer pruning targets less important attention heads and feed-forward network (FFN) neurons within model layers, aiming to maintain performance while significantly shrinking the model. It supports both iterative pruning and mask-based approaches.
Quick Start & Requirements
pip install textpruner
Highlighted Details
Maintenance & Community
Licensing & Compatibility
Limitations & Caveats
n_iters
and potentially using uneven head configurations.1 year ago
Inactive