Run SparseGPT on OPT models
masterUse opt.py to perform various compression tasks on OPT models. You can specify the HuggingFace model name and the evaluation dataset (e.g., c4).
Common Tasks:
- Dense Baseline: Run the model without pruning.
- Magnitude Baseline: Run pruning using the Magnitude Pruning (GMP) method.
- Uniform Sparsity: Prune to a specific sparsity level (e.g., 50%).
- N:M Sparsity: Prune to a structured 2:4 sparsity pattern.
- Sparse + Quantized: Combine sparsity with weight quantization (e.g., 4-bit).
# Run dense baseline
python opt.py facebook/opt-125m c4
# Run magnitude baseline
python opt.py facebook/opt-125m c4 --sparsity .5 --gmp
# Prune to 50% uniform sparsity with SparseGPT
python opt.py facebook/opt-125m c4 --sparsity .5
# Prune to full 2:4 sparsity with SparseGPT
python opt.py facebook/opt-125m c4 --prunen 2 --prunem 4
# Prune to 50% + 4-bit with SparseGPT
python opt.py facebook/opt-125m c4 --sparsity .5 --wbits 4