Skip to main content

entrenar/hf_pipeline/
mod.rs

1//! HuggingFace Distillation & Learning Pipeline
2//!
3//! This module provides integration with HuggingFace Hub for:
4//! - Model downloading with authentication
5//! - Knowledge distillation from teacher to student models
6//! - Fine-tuning with LoRA/QLoRA
7//! - Dataset streaming
8//!
9//! # References
10//!
11//! - Hinton et al. (2015) "Distilling the Knowledge in a Neural Network"
12//! - Hu et al. (2021) "LoRA: Low-Rank Adaptation of Large Language Models"
13//! - Dettmers et al. (2023) "QLoRA: Efficient Finetuning of Quantized LLMs"
14//!
15//! # Example
16//!
17//! ```ignore
18//! use entrenar::hf_pipeline::{HfModelFetcher, FetchOptions};
19//!
20//! let fetcher = HfModelFetcher::new()?;
21//! let artifact = fetcher.download_model("microsoft/codebert-base", FetchOptions::default())?;
22//! ```
23
24mod config;
25mod dataset;
26mod distillation;
27mod error;
28mod export;
29mod fetcher;
30mod fine_tune;
31#[cfg(feature = "hub-publish")]
32pub mod leaderboard;
33mod loader;
34#[cfg(feature = "hub-publish")]
35pub mod publish;
36mod trainer;
37
38#[cfg(test)]
39mod tests;
40
41pub use config::DistillationYamlConfig;
42pub use dataset::{
43    Batch, CacheStats, Dataset, DatasetOptions, DistillationCollator, Example, HfDatasetFetcher,
44    Split, TeacherCache,
45};
46pub use distillation::{AttentionTransfer, DistillationLoss, ProgressiveDistillation};
47pub use error::{FetchError, Result};
48pub use export::{
49    quantize_and_export, verify_gguf, ExportFormat, ExportResult, Exporter, GgufQuantization,
50    GgufSummary, GgufTensorInfo, ModelMetadata, ModelWeights, QuantExportResult,
51};
52#[cfg(feature = "hub-publish")]
53pub use export::{quantize_export_publish, QuantPublishError, QuantPublishResult};
54pub use fetcher::{Architecture, FetchOptions, HfModelFetcher, ModelArtifact, WeightFormat};
55pub use fine_tune::{FineTuneConfig, FineTuneMethod, MemoryRequirement, MixedPrecision};
56pub use loader::{MemoryEstimate, SafeTensorsTeacher, TeacherModel};
57pub use trainer::{DistillationTrainer, TrainerConfig, TrainingState};