mod axolotl;
mod metrics;
mod phase;
pub mod sizing;
mod yaml;
use std::path::{Path, PathBuf};
pub use axolotl::{
Axolotl, CONFIG_FILE, MERGED_DIR, METRICS_FILE, OUTPUT_DIR, Outputs, RESUME_DIR, Resume,
TemplateReasoning, reasoning_template_warning, template_reasoning,
};
pub use metrics::{
JobStage, METRICS_ENV, METRICS_PLUGIN, Mark, MetricLine, PLUGIN_CLASS, PLUGIN_FILE, Pace,
SNAPSHOT_ENV, SNAPSHOT_FILE, SNAPSHOT_REQUEST, TrainMetric, parse_line,
};
pub use phase::{Phase, Phases};
pub use yaml::{to_yaml, top_level_scalar};
#[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;
fn stop_marker(&self) -> Option<&'static str> {
None
}
fn stages(&self) -> Vec<JobStage> {
Vec::new()
}
fn metrics_required(&self) -> bool {
true
}
fn caches_tools(&self) -> bool {
false
}
}