mirror of
https://github.com/hanzoai/ml.git
synced 2026-11-20 23:08:29 +00:00
41 lines
1.1 KiB
Rust
41 lines
1.1 KiB
Rust
//! Example: Train Qwen3-4B on zen-agentic-dataset
|
|
|
|
use anyhow::Result;
|
|
use hanzo_training::{init_logging, Trainer, TrainingConfig};
|
|
use tracing::info;
|
|
|
|
#[tokio::main]
|
|
async fn main() -> Result<()> {
|
|
// Initialize logging
|
|
init_logging()?;
|
|
|
|
info!("🚀 Starting Qwen3-4B training on zen-agentic-dataset");
|
|
|
|
// Load configuration
|
|
let config = TrainingConfig::from_file("configs/zen-agentic-qwen4b.yaml")?;
|
|
|
|
// Validate configuration
|
|
config.validate()?;
|
|
info!("✅ Configuration validated");
|
|
|
|
// Create trainer
|
|
let mut trainer = Trainer::new(config)?;
|
|
info!("✅ Trainer created");
|
|
|
|
// Start training
|
|
info!("🎯 Starting training...");
|
|
let result = trainer.train()?;
|
|
|
|
// Print results
|
|
info!("🎉 Training completed successfully!");
|
|
info!("Final loss: {:.6}", result.final_loss);
|
|
info!("Total steps: {}", result.total_steps);
|
|
info!("Training time: {:.2}s", result.training_time);
|
|
|
|
// Save final model
|
|
trainer.save_checkpoint(std::path::Path::new("./output/qwen3-4b-zen-agentic"))?;
|
|
info!("💾 Model saved to ./output/qwen3-4b-zen-agentic");
|
|
|
|
Ok(())
|
|
}
|