Skip to main content

oa/core/
config.rs

1//! Shared training and logging configuration structs.
2//!
3//! Port provenance: `oa/core/config.h`.
4//!
5//! These structs are the shared config layer used by CLI applications,
6//! [`crate::ml::training`] callbacks, and logging sessions. They are
7//! deliberately plain-data; the application supplies YAML loading by
8//! implementing the optional [`crate::Cli`] hooks.
9//!
10//! # Usage
11//!
12//! ```rust,ignore
13//! let ckpt = oa::CheckpointConfig {
14//!     dir:  oa::Path::var_rel("model/dev"),
15//!     name: "CharMamba3".into(),
16//!     ..Default::default()
17//! };
18//! let log = oa::LogConfig::default();
19//! ```
20
21pub use super::types::{CheckpointConfig, LogConfig};
22use crate::Path;
23
24// ─── CheckpointConfig ────────────────────────────────────────────────────────
25
26impl Default for CheckpointConfig {
27	fn default() -> Self {
28		Self {
29			dir: Path::var_rel("checkpoints"),
30			name: "model".into(),
31			env: "dev".into(),
32			save_best: true,
33			save_last: true,
34		}
35	}
36}
37
38// ─── LogConfig ───────────────────────────────────────────────────────────────
39
40impl Default for LogConfig {
41	fn default() -> Self {
42		Self {
43			dir: Path::var_rel("log"),
44			level: "info".into(),
45			console: true,
46			file: false,
47			metrics: true,
48		}
49	}
50}