From 83299b4d047df84116f53df215c4f67ffde2650f Mon Sep 17 00:00:00 2001 From: ruv Date: Sun, 31 May 2026 02:28:16 -0400 Subject: [PATCH] feat(cog-pose): --adapter CLI flag for per-room calibration Completes the end-to-end product path: cog-pose-estimation run --config --adapter loads the shared base + a per-room LoRA adapter for calibrated inference. Adds InferenceEngine::with_adapter() (default weights + adapter) and logs when a calibration adapter is active. 6/6 tests pass. Co-Authored-By: claude-flow --- v2/crates/cog-pose-estimation/src/inference.rs | 6 ++++++ v2/crates/cog-pose-estimation/src/main.rs | 17 ++++++++++++++--- 2 files changed, 20 insertions(+), 3 deletions(-) diff --git a/v2/crates/cog-pose-estimation/src/inference.rs b/v2/crates/cog-pose-estimation/src/inference.rs index 6f491248..8980aee3 100644 --- a/v2/crates/cog-pose-estimation/src/inference.rs +++ b/v2/crates/cog-pose-estimation/src/inference.rs @@ -191,6 +191,12 @@ impl InferenceEngine { Self::with_weights(default_weights_path().as_deref()) } + /// Engine from the default base weights plus an optional per-room calibration + /// adapter (ADR-150 §3.5). Used by `cog-pose-estimation run --adapter `. + pub fn with_adapter(adapter_path: Option<&Path>) -> Result> { + Self::with_weights_and_adapter(default_weights_path().as_deref(), adapter_path) + } + /// Create an engine with a specific weights path (used by `--config` /// in `cog-pose-estimation run`). If `weights_path` is `None`, the /// stub fallback is used. diff --git a/v2/crates/cog-pose-estimation/src/main.rs b/v2/crates/cog-pose-estimation/src/main.rs index fcd28934..da947045 100644 --- a/v2/crates/cog-pose-estimation/src/main.rs +++ b/v2/crates/cog-pose-estimation/src/main.rs @@ -42,6 +42,11 @@ enum Cmd { /// Path to runtime config JSON. See `cog/config.schema.json`. #[arg(long, value_name = "PATH")] config: PathBuf, + /// Optional per-room LoRA calibration adapter (ADR-150 §3.5). Fit one with + /// `aether-arena/calibration/calibrate.py`; attaching it recovers SOTA-level + /// pose in an unseen room/person. + #[arg(long, value_name = "PATH")] + adapter: Option, }, } @@ -53,7 +58,7 @@ fn main() -> std::process::ExitCode { Cmd::Version => cmd_version(), Cmd::Manifest => cmd_manifest(), Cmd::Health => cmd_health(), - Cmd::Run { config } => cmd_run(config), + Cmd::Run { config, adapter } => cmd_run(config, adapter), }; match result { @@ -99,11 +104,17 @@ fn cmd_health() -> Result<(), Box> { } } -fn cmd_run(config_path: PathBuf) -> Result<(), Box> { +fn cmd_run( + config_path: PathBuf, + adapter: Option, +) -> Result<(), Box> { let cfg = CogConfig::load(&config_path)?; emit_event(&Event::run_started(COG_ID, &cfg)); - let engine = InferenceEngine::new()?; + let engine = InferenceEngine::with_adapter(adapter.as_deref())?; + if engine.is_calibrated() { + tracing::info!("per-room calibration adapter loaded"); + } let rt = tokio::runtime::Builder::new_multi_thread() .enable_all() .build()?;