Expand description
Neural network pruning integration for Entrenar
This module provides training-time pruning capabilities that integrate with the Aprender pruning primitives. It implements:
- Pruning Schedules: OneShot, Gradual, and Cubic sparsity schedules
- Pruning Callback: Integration with the training loop
- Calibration Pipeline: Activation collection for Wanda/SparseGPT
- Prune-Finetune Pipeline: End-to-end pruning workflow
§Toyota Way Principles
- Kaizen (Continuous Improvement): Gradual pruning schedules
- Jidoka (Quality at Source): Validates sparsity at each step
- Genchi Genbutsu (Go and See): Uses real activation data
§Example
ⓘ
use entrenar::prune::{PruningSchedule, PruningCallback, PruningConfig};
use aprender::pruning::{MagnitudeImportance, WandaPruner};
let schedule = PruningSchedule::Gradual {
start_step: 1000,
end_step: 10000,
initial_sparsity: 0.0,
final_sparsity: 0.5,
frequency: 100,
};
let config = PruningConfig::default()
.with_schedule(schedule)
.with_target_sparsity(0.5);
let callback = PruningCallback::new(config);
trainer.add_callback(callback);§References
- Han, S., et al. (2015). Learning both weights and connections. NeurIPS.
- Sun, M., et al. (2023). A simple and effective pruning approach. arXiv:2306.11695.
- Zhu, M., & Gupta, S. (2017). To prune, or not to prune. arXiv:1710.01878.
Structs§
- Calibration
Collector - Calibration data collector for pruning.
- Calibration
Config - Configuration for calibration data collection.
- Calibration
Data Config - Configuration for calibration data loading.
- Calibration
Data Loader - Calibration data loader for pruning.
- Prune
Finetune Pipeline - Prune-Finetune pipeline orchestrator.
- Prune
Trainer - Prune-finetune trainer that orchestrates the full pipeline.
- Prune
Trainer Config - Configuration for the prune-finetune trainer.
- Pruning
Callback - Callback for applying pruning during training.
- Pruning
Config - Configuration for pruning operations.
- Pruning
Metrics - Metrics collected during pruning.
Enums§
- Prune
Method - Pruning method selection.
- Pruning
Schedule - Pruning schedule defining when sparsity increases during training.
- Pruning
Stage - Current stage of the pruning pipeline.
- Sparsity
Pattern Config - Sparsity pattern selection.