mod axolotl;
mod metrics;
mod yaml;
use std::path::{Path, PathBuf};
pub use axolotl::{Axolotl, CONFIG_FILE, METRICS_FILE, OUTPUT_DIR, reasoning_template_warning};
pub use metrics::{
METRICS_ENV, METRICS_PLUGIN, MetricLine, PLUGIN_CLASS, PLUGIN_FILE, TrainMetric, parse_line,
};
pub use yaml::to_yaml;
#[derive(Debug, thiserror::Error)]
pub enum TrainError {
#[error("cannot access {}", path.display())]
Io {
path: PathBuf,
#[source]
source: std::io::Error,
},
#[error("cannot copy {} to {}", from.display(), to.display())]
Copy {
from: PathBuf,
to: PathBuf,
#[source]
source: std::io::Error,
},
#[error("{} has no example: run `overbrainer split` first", path.display())]
NoTrainingData {
path: PathBuf,
},
}
#[derive(Debug, Clone, PartialEq, Eq)]
pub struct Artifacts {
pub entries: Vec<String>,
pub exclude: Vec<String>,
pub required: Option<String>,
}
pub trait Trainer {
fn prepare(&self, run_dir: &Path, root: &str) -> Result<(), TrainError>;
fn commands(&self) -> Vec<Vec<String>>;
fn env(&self, root: &str) -> Vec<(String, String)>;
fn metrics_file(&self) -> &'static str;
fn artifacts(&self) -> Artifacts;
}