1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
//! Production pipeline for large model compression with checkpointing.
//!
//! This module provides a robust, resumable compression pipeline designed for
//! compressing very large models (100GB+) with:
//!
//! - **Streaming I/O**: Memory-mapped shard reading to avoid loading full files
//! - **Checkpointing**: Per-tensor state tracking for crash recovery
//! - **Incremental output**: Append-only writing with deferred header finalization
//! - **Quality validation**: Sampled reconstruction quality checks
//!
//! ## Architecture
//!
//! ```text
//! ┌──────────┐ ┌──────────┐ ┌──────────┐ ┌──────────┐
//! │ Shard │───▶│ Tensor │───▶│ Compress │───▶│ Output │
//! │ Scanner │ │ Streamer │ │ Worker │ │ Writer │
//! └──────────┘ └──────────┘ └──────────┘ └──────────┘
//! │ │ │ │
//! └───────────────┴───────────────┴───────────────┘
//! │
//! ┌─────────▼─────────┐
//! │ Checkpoint Manager │
//! └───────────────────┘
//! ```
//!
//! ## Usage
//!
//! ```ignore
//! use haagenti::pipeline::{CompressionPipeline, PipelineConfig};
//!
//! // Start fresh or resume from checkpoint
//! let config = PipelineConfig {
//! model: "meta-llama/Llama-3.1-405B".to_string(),
//! output_dir: PathBuf::from("./compressed"),
//! retention: 0.70,
//! ..Default::default()
//! };
//!
//! let mut pipeline = CompressionPipeline::new_or_resume(config)?;
//! let report = pipeline.run()?;
//!
//! println!("Compressed {} tensors, ratio: {:.1}x",
//! report.tensors_completed,
//! report.compression_ratio);
//! ```
//!
//! ## Resumption
//!
//! If the pipeline is interrupted, simply run again with `--resume`:
//!
//! ```bash
//! cargo run --release --example compress_405b -- \
//! --model meta-llama/Llama-3.1-405B \
//! --output ./compressed \
//! --resume
//! ```
pub use ;
pub use ;
pub use ;
pub use ;
pub use ;
pub use ;