mirror of
https://github.com/ruvnet/RuView.git
synced 2026-06-02 00:58:56 +02:00
feat(cog-pose): --adapter CLI flag for per-room calibration
Completes the end-to-end product path: cog-pose-estimation run --config <cfg> --adapter <room.safetensors> 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 <ruv@ruv.net>
This commit is contained in:
@@ -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 <path>`.
|
||||
pub fn with_adapter(adapter_path: Option<&Path>) -> Result<Self, Box<dyn std::error::Error>> {
|
||||
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.
|
||||
|
||||
@@ -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<PathBuf>,
|
||||
},
|
||||
}
|
||||
|
||||
@@ -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<dyn std::error::Error>> {
|
||||
}
|
||||
}
|
||||
|
||||
fn cmd_run(config_path: PathBuf) -> Result<(), Box<dyn std::error::Error>> {
|
||||
fn cmd_run(
|
||||
config_path: PathBuf,
|
||||
adapter: Option<PathBuf>,
|
||||
) -> Result<(), Box<dyn std::error::Error>> {
|
||||
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()?;
|
||||
|
||||
Reference in New Issue
Block a user