mirror of
https://github.com/shinyobjectz/raea.git
synced 2026-12-06 08:46:06 -10:00
Compare commits
4
Commits
zoo
..
paint-260-262
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
05ada509e4 | ||
|
|
5922b25227 | ||
|
|
8a459acbe5 | ||
|
|
8d60b97d16 |
No files matched your search
Generated
-1
@@ -13919,7 +13919,6 @@ dependencies = [
|
||||
name = "raea-app-motion"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"glam 0.33.12",
|
||||
"raea-io-home",
|
||||
"raea-runtime-bundle",
|
||||
"raea-sys-kimodo",
|
||||
|
||||
@@ -7,8 +7,6 @@ publish = false
|
||||
description = "`raea motion` and `raea setup motion`: body motion made by Kimodo on this machine, on MLX on a Mac, on PyTorch elsewhere"
|
||||
|
||||
[dependencies]
|
||||
# a take's joints as vectors (score.rs)
|
||||
glam = "0.33"
|
||||
# raea's models folder, where the models and the PyTorch environment go
|
||||
raea-io-home = { path = "../../io/home" }
|
||||
serde_json = "1"
|
||||
|
||||
@@ -1,12 +0,0 @@
|
||||
//! `raea motion` without the rest of the CLI, for working on this crate while the workspace's other crates are mid-change:
|
||||
//! `lane build -- cargo run --release -p raea-app-motion --example motion -- "LINE" --seeds 4 -o CLIP.json`
|
||||
fn main() {
|
||||
let args: Vec<String> = std::iter::once("motion".to_string()).chain(std::env::args().skip(1)).collect();
|
||||
match raea_app_motion::motion(&args) {
|
||||
Ok(s) => println!("{s}"),
|
||||
Err(e) => {
|
||||
eprintln!("{e}");
|
||||
std::process::exit(1)
|
||||
}
|
||||
}
|
||||
}
|
||||
+19
-62
@@ -9,14 +9,12 @@
|
||||
|
||||
use std::path::PathBuf;
|
||||
|
||||
mod score;
|
||||
|
||||
use raea_runtime_bundle::flag;
|
||||
|
||||
type R<T> = Result<T, String>;
|
||||
|
||||
pub const USAGE: &str = "raea motion \"LINE\" [--keys KEYS.json] [--seconds 5 | --frames N] [--seed 1] [--seeds 1] [--steps 100] [-o CLIP.json]";
|
||||
pub const ABOUT: &str = "body motion made on this machine by Kimodo (NVIDIA): a SOMA clip from a line of words and, with --keys, Kimodo constraints (full-body keyframes, hand or foot targets, a root path, as sdk/body/tools/between.ts writes them), as the clip sdk/body/tools/fromkimodo.ts reads. On a Mac it runs on MLX (Apple silicon's GPU): the first use fetches the motion model (1.1 GB) into raea's models folder, and the first new line its text encoder (8.8 GB: Llama 3 8B in 8 bits with LLM2Vec's adapters). On Linux and Windows it runs upstream Kimodo on PyTorch, set up once by raea setup motion: on an NVIDIA GPU with CUDA (the text encoder, 16 GB in bf16, on the CPU unless the card has 18 GB or more), else on the CPU alone; reading a new line on the CPU takes about 18 GB of memory. A line's words are read once and kept. --seeds N makes N takes (seeds SEED to SEED+N-1) and keeps the one with the fewest faults: a foot sliding while planted, the shoulders shrugging, the hips sinking, a hand or forearm into the torso or head (a skeletal check; each take's score is printed and the kept one's written into the clip). Licences: Kimodo's weights NVIDIA's Open Model License, Meta Llama 3 the Meta Llama 3 Community License, LLM2Vec's adapters MIT, Kimodo's code Apache-2.0";
|
||||
pub const USAGE: &str = "raea motion \"LINE\" [--keys KEYS.json] [--seconds 5 | --frames N] [--seed 1] [--steps 100] [-o CLIP.json]";
|
||||
pub const ABOUT: &str = "body motion made on this machine by Kimodo (NVIDIA): a SOMA clip from a line of words and, with --keys, Kimodo constraints (full-body keyframes, hand or foot targets, a root path, as sdk/body/tools/between.ts writes them), as the clip sdk/body/tools/fromkimodo.ts reads. On a Mac it runs on MLX (Apple silicon's GPU): the first use fetches the motion model (1.1 GB) into raea's models folder, and the first new line its text encoder (8.8 GB: Llama 3 8B in 8 bits with LLM2Vec's adapters). On Linux and Windows it runs upstream Kimodo on PyTorch, set up once by raea setup motion: on an NVIDIA GPU with CUDA (the text encoder, 16 GB in bf16, on the CPU unless the card has 18 GB or more), else on the CPU alone; reading a new line on the CPU takes about 18 GB of memory. A line's words are read once and kept. Licences: Kimodo's weights NVIDIA's Open Model License, Meta Llama 3 the Meta Llama 3 Community License, LLM2Vec's adapters MIT, Kimodo's code Apache-2.0";
|
||||
|
||||
pub const SETUP_USAGE: &str = "raea setup motion [--check]";
|
||||
pub const SETUP_ABOUT: &str = "what raea motion runs on, made where missing (--check only says): on a Mac the MLX models in raea's models folder (the motion model 1.1 GB, the text encoder 8.8 GB); on Linux and Windows, in raea's models folder's kimodo-torch, a Python 3.11 environment made by uv (which it needs on PATH: https://docs.astral.sh/uv) with PyTorch (its CUDA build where there is an NVIDIA driver, about 8 GB, else CPU only, about 2 GB) and upstream Kimodo (nv-tlabs/kimodo at e1c219c, Apache-2.0), then the weights: Kimodo-SOMA-RP-v1 (1.1 GB, NVIDIA Open Model License), LLM2Vec's two adapters (0.3 GB, MIT) and Meta Llama 3 8B Instruct in bf16 (16 GB, Meta Llama 3 Community License, from NousResearch's ungated copy, checked file by file against Meta's SHA-256); about 26 GB in all. It says what this machine has and where each network runs: the denoiser on CUDA when there is an NVIDIA GPU, else the CPU; the text encoder beside it on a GPU of 18 GB or more, else the CPU";
|
||||
@@ -29,7 +27,7 @@ fn number(args: &[String], name: &str, default: f64) -> R<f64> {
|
||||
}
|
||||
|
||||
fn line(args: &[String]) -> String {
|
||||
const WITH_VALUE: [&str; 7] = ["--keys", "--seconds", "--frames", "--seed", "--seeds", "--steps", "-o"];
|
||||
const WITH_VALUE: [&str; 6] = ["--keys", "--seconds", "--frames", "--seed", "--steps", "-o"];
|
||||
let mut out = Vec::new();
|
||||
let mut i = 1;
|
||||
while i < args.len() {
|
||||
@@ -52,7 +50,6 @@ struct Ask {
|
||||
constraints: Option<serde_json::Value>,
|
||||
frames: usize,
|
||||
seed: u64,
|
||||
seeds: usize,
|
||||
steps: usize,
|
||||
out: Option<String>,
|
||||
}
|
||||
@@ -67,21 +64,15 @@ pub fn motion(args: &[String]) -> R<String> {
|
||||
Some(_) => number(args, "--frames", 150.0)? as usize,
|
||||
None => (number(args, "--seconds", 5.0)? * 30.0).round() as usize,
|
||||
};
|
||||
// Kimodo's own limit (its docs, key_concepts/limitations.md): past 10 s a clip drifts and breaks up (11-27: a
|
||||
// 12.3 s talk clip's feet spread 47 -> 69 cm, shoulders rose 9 cm, the last half second glitched)
|
||||
if !(2..=300).contains(&frames) {
|
||||
return Err(format!(
|
||||
"a clip is 2 to 300 frames (10 s at 30 a second, Kimodo's limit: longer clips drift and break up), asked {frames}; \
|
||||
for longer, make 10 s clips one after another, each from --keys holding the last frames of the one before"
|
||||
));
|
||||
if !(2..=600).contains(&frames) {
|
||||
return Err(format!("a clip is 2 to 600 frames (20 s at 30 a second), asked {frames}"));
|
||||
}
|
||||
let constraints = match &keys {
|
||||
Some(p) => Some(serde_json::from_str::<serde_json::Value>(&std::fs::read_to_string(p).map_err(|e| format!("{p}: {e}"))?).map_err(|e| format!("{p}: {e}"))?),
|
||||
None => None,
|
||||
};
|
||||
let (seed, steps) = (number(args, "--seed", 1.0)? as u64, (number(args, "--steps", 100.0)? as usize).max(2));
|
||||
let seeds = (number(args, "--seeds", 1.0)? as usize).clamp(1, 32);
|
||||
make(Ask { words, keys, constraints, frames, seed, seeds, steps, out: flag(args, "-o") })
|
||||
make(Ask { words, keys, constraints, frames, seed, steps, out: flag(args, "-o") })
|
||||
}
|
||||
|
||||
/// -o, else a file named by the line's words in the working folder
|
||||
@@ -92,25 +83,6 @@ fn out_path(out: Option<String>, clean: &str) -> PathBuf {
|
||||
}))
|
||||
}
|
||||
|
||||
/// the take with the lowest score of those made, its seed, and a line per take ("" for a single take)
|
||||
fn keep_best(takes: Vec<(u64, raea_sys_kimodo::decode::Motion)>, sk: &raea_sys_kimodo::skeleton::Skeleton) -> (u64, raea_sys_kimodo::decode::Motion, Option<score::Score>, String) {
|
||||
let one = takes.len() == 1;
|
||||
let mut scored: Vec<(u64, raea_sys_kimodo::decode::Motion, score::Score)> = takes.into_iter().map(|(s, m)| { let sc = score::score(&m, sk); (s, m, sc) }).collect();
|
||||
let report = if one { String::new() } else { scored.iter().map(|(s, _, sc)| format!("\n seed {s}: {}", sc.line())).collect::<String>() };
|
||||
scored.sort_by(|a, b| a.2.total.total_cmp(&b.2.total));
|
||||
let (s, m, sc) = scored.remove(0);
|
||||
(s, m, Some(sc), report)
|
||||
}
|
||||
|
||||
/// the kept take's score, written into the clip
|
||||
fn with_score(mut clip: serde_json::Value, sc: &Option<score::Score>, tried: usize) -> serde_json::Value {
|
||||
if let Some(sc) = sc {
|
||||
clip["score"] = serde_json::json!({"total": sc.total, "foot_drift_cm": sc.foot_drift_cm, "shoulder_rise_cm": sc.shoulder_rise_cm,
|
||||
"hip_drop_cm": sc.hip_drop_cm, "collision_cm": sc.collision_cm, "takes": tried});
|
||||
}
|
||||
clip
|
||||
}
|
||||
|
||||
/// how far the hips end from where they start, on the ground
|
||||
fn travel(m: &raea_sys_kimodo::decode::Motion) -> f32 {
|
||||
let r = &m.root;
|
||||
@@ -137,17 +109,10 @@ fn make(ask: Ask) -> R<String> {
|
||||
));
|
||||
}
|
||||
let keys = ask.keys.as_ref().map(std::path::Path::new);
|
||||
let job = torch::Job { line: &ask.words, frames: ask.frames, seed: ask.seed, steps: ask.steps, keys, cfg: (2.0, 2.0) };
|
||||
let made = t.make(&job).map_err(|e| format!("raea motion: {e}"))?;
|
||||
let (stats, sk) = (Stats::load(&t.checkpoint).map_err(|e| format!("raea motion: {e}"))?, Skeleton::soma().map_err(|e| format!("raea motion: {e}"))?);
|
||||
let mut takes = Vec::new();
|
||||
let mut last = None;
|
||||
for s in ask.seed..ask.seed + ask.seeds as u64 {
|
||||
let job = torch::Job { line: &ask.words, frames: ask.frames, seed: s, steps: ask.steps, keys, cfg: (2.0, 2.0) };
|
||||
let made = t.make(&job).map_err(|e| format!("raea motion: {e}"))?;
|
||||
takes.push((s, decode::decode(&made.features, &stats, &sk)));
|
||||
last = Some(made);
|
||||
}
|
||||
let made = last.ok_or("raea motion: no take")?;
|
||||
let (seed, motion, sc, report) = keep_best(takes, &sk);
|
||||
let motion = decode::decode(&made.features, &stats, &sk);
|
||||
let info = &made.info;
|
||||
let clean = info["line"].as_str().unwrap_or(&ask.words).to_string();
|
||||
let (dev, text_dev) = (info["motion"].as_str().unwrap_or("?"), info["text"].as_str().unwrap_or("?"));
|
||||
@@ -155,28 +120,26 @@ fn make(ask: Ask) -> R<String> {
|
||||
Some(g) => format!("on PyTorch {} with CUDA ({g}; the text encoder on {text_dev}), upstream nv-tlabs/kimodo {}", info["torch"].as_str().unwrap_or("?"), &torch::KIMODO[..7]),
|
||||
None => format!("on PyTorch {} on the CPU, upstream nv-tlabs/kimodo {}", info["torch"].as_str().unwrap_or("?"), &torch::KIMODO[..7]),
|
||||
};
|
||||
let clip = with_score(decode::clip_json_on(&motion, &sk, seed, ask.steps, &clean, ask.constraints.is_some(), &on), &sc, ask.seeds);
|
||||
let clip = decode::clip_json_on(&motion, &sk, ask.seed, ask.steps, &clean, ask.constraints.is_some(), &on);
|
||||
let out = out_path(ask.out, &clean);
|
||||
std::fs::write(&out, serde_json::to_string(&clip).unwrap_or_default()).map_err(|e| format!("{}: {e}", out.display()))?;
|
||||
// the hips as PyTorch decoded them against decode.rs's: the features were read as Kimodo wrote them
|
||||
let ours: Vec<[f32; 3]> = motion.joints77.iter().map(|f| f[0]).collect();
|
||||
let gap = if ask.seeds > 1 { String::new() } else { torch::root_gap(&info["root"], &ours).map(|g| format!(", decoded here within {:.3} mm of PyTorch's own", g * 1000.0)).unwrap_or_default() };
|
||||
let gap = torch::root_gap(&info["root"], &ours).map(|g| format!(", decoded here within {:.3} mm of PyTorch's own", g * 1000.0)).unwrap_or_default();
|
||||
let f = |k: &str| info[k].as_f64().unwrap_or(0.0);
|
||||
let read = if f("read_s") > 0.0 { format!(", reading the line {:.1} s after {:.1} s loading its encoder", f("read_s"), f("text_load_s")) } else { String::new() };
|
||||
Ok(format!(
|
||||
"APPLIED motion {:?}{}, {} frames ({:.1} s), seed {}{}, {} steps -> {} (made {on} in {:.1} s after {:.1} s loading{read}; the hips end {:.2} m from where they start{gap}; {}){report}",
|
||||
"APPLIED motion {:?}{}, {} frames ({:.1} s), seed {}, {} steps -> {} (made {on} in {:.1} s after {:.1} s loading{read}; the hips end {:.2} m from where they start{gap})",
|
||||
clean,
|
||||
if ask.keys.is_some() { " with keys" } else { "" },
|
||||
ask.frames,
|
||||
ask.frames as f64 / 30.0,
|
||||
seed,
|
||||
if ask.seeds > 1 { format!(", the best of {} takes", ask.seeds) } else { String::new() },
|
||||
ask.seed,
|
||||
ask.steps,
|
||||
out.display(),
|
||||
f("gen_s"),
|
||||
f("load_s"),
|
||||
travel(&motion),
|
||||
sc.as_ref().map(|s| s.line()).unwrap_or_default(),
|
||||
))
|
||||
}
|
||||
|
||||
@@ -191,29 +154,23 @@ fn make(ask: Ask) -> R<String> {
|
||||
let mut k = raea_sys_kimodo::Kimodo::fetch(&mut progress).map_err(|e| format!("raea motion: {e}"))?;
|
||||
let (clean, emb) = k.encode(&ask.words).map_err(|e| format!("raea motion: {e}"))?;
|
||||
let load_s = t0.elapsed().as_secs_f64();
|
||||
let made_from = raea_sys_kimodo::Ask { line: &ask.words, frames: ask.frames, seed: ask.seed, steps: ask.steps, constraints: ask.constraints.as_ref(), cfg: (2.0, 2.0) };
|
||||
let t1 = std::time::Instant::now();
|
||||
let mut takes = Vec::new();
|
||||
for s in ask.seed..ask.seed + ask.seeds as u64 {
|
||||
let made_from = raea_sys_kimodo::Ask { line: &ask.words, frames: ask.frames, seed: s, steps: ask.steps, constraints: ask.constraints.as_ref(), cfg: (2.0, 2.0) };
|
||||
takes.push((s, k.make(&made_from, emb.as_deref(), None).map_err(|e| format!("raea motion: {e}"))?.motion));
|
||||
}
|
||||
let made = k.make(&made_from, emb.as_deref(), None).map_err(|e| format!("raea motion: {e}"))?;
|
||||
let gen_s = t1.elapsed().as_secs_f64();
|
||||
let (seed, motion, sc, report) = keep_best(takes, &k.skeleton);
|
||||
let clip = with_score(raea_sys_kimodo::decode::clip_json(&motion, &k.skeleton, seed, ask.steps, &clean, ask.constraints.is_some()), &sc, ask.seeds);
|
||||
let clip = raea_sys_kimodo::decode::clip_json(&made.motion, &k.skeleton, ask.seed, ask.steps, &clean, ask.constraints.is_some());
|
||||
let out = out_path(ask.out, &clean);
|
||||
std::fs::write(&out, serde_json::to_string(&clip).unwrap_or_default()).map_err(|e| format!("{}: {e}", out.display()))?;
|
||||
Ok(format!(
|
||||
"APPLIED motion {:?}{}, {} frames ({:.1} s), seed {}{}, {} steps -> {} (made on this Mac in {gen_s:.1} s after {load_s:.1} s loading and reading the line; the hips end {:.2} m from where they start; {}){report}",
|
||||
"APPLIED motion {:?}{}, {} frames ({:.1} s), seed {}, {} steps -> {} (made on this Mac in {gen_s:.1} s after {load_s:.1} s loading and reading the line; the hips end {:.2} m from where they start)",
|
||||
clean,
|
||||
if ask.keys.is_some() { " with keys" } else { "" },
|
||||
ask.frames,
|
||||
ask.frames as f64 / 30.0,
|
||||
seed,
|
||||
if ask.seeds > 1 { format!(", the best of {} takes", ask.seeds) } else { String::new() },
|
||||
ask.seed,
|
||||
ask.steps,
|
||||
out.display(),
|
||||
travel(&motion),
|
||||
sc.as_ref().map(|s| s.line()).unwrap_or_default(),
|
||||
travel(&made.motion)
|
||||
))
|
||||
}
|
||||
|
||||
|
||||
@@ -1,111 +0,0 @@
|
||||
//! A take scored for the faults a body shows (sheet3d plan E3), so `raea motion --seeds N` can keep the best of N:
|
||||
//! a foot sliding while it's planted, the shoulders shrugging up, the hips sinking, and a hand or forearm inside the
|
||||
//! torso or head. Read from the take's own joints (Kimodo's SOMA skeleton, metres, Y up) and its foot contacts.
|
||||
//! Collision is a skeletal proxy: capsules round the spine and a sphere for the head, sized for SOMA's average adult;
|
||||
//! the mesh check on the body a clip drives is the join's (sheet3d's join.py: head-in-body frames).
|
||||
|
||||
use raea_sys_kimodo::decode::Motion;
|
||||
use raea_sys_kimodo::skeleton::Skeleton;
|
||||
|
||||
use glam::Vec3;
|
||||
|
||||
/// each fault in centimetres (collision: the deepest a hand or forearm point goes into the torso or head), and
|
||||
/// their sum, each over its own allowance: 1 cm of drift, 3 cm of shrug, 5 cm of sinking, 1 cm into the body
|
||||
pub struct Score {
|
||||
pub foot_drift_cm: f32,
|
||||
pub shoulder_rise_cm: f32,
|
||||
pub hip_drop_cm: f32,
|
||||
pub collision_cm: f32,
|
||||
pub total: f32,
|
||||
}
|
||||
|
||||
fn idx(sk: &Skeleton, n: &str) -> usize {
|
||||
sk.names77.iter().position(|x| x == n).unwrap_or(0)
|
||||
}
|
||||
|
||||
/// how far p is inside the capsule a-b of radius r (0 outside)
|
||||
fn inside(p: [f32; 3], a: [f32; 3], b: [f32; 3], r: f32) -> f32 {
|
||||
let (p, a, b) = (Vec3::from(p), Vec3::from(a), Vec3::from(b));
|
||||
let ab = b - a;
|
||||
let t = ((p - a).dot(ab) / ab.length_squared().max(1e-9)).clamp(0.0, 1.0);
|
||||
(r - p.distance(a + t * ab)).max(0.0)
|
||||
}
|
||||
|
||||
fn median(mut v: Vec<f32>) -> f32 {
|
||||
if v.is_empty() {
|
||||
return 0.0;
|
||||
}
|
||||
v.sort_by(|a, b| a.total_cmp(b));
|
||||
v[v.len() / 2]
|
||||
}
|
||||
|
||||
pub fn score(m: &Motion, sk: &Skeleton) -> Score {
|
||||
let j = &m.joints77;
|
||||
let n = j.len();
|
||||
// a foot planted: its horizontal travel over each run of contact frames, the worst run
|
||||
let feet = [("LeftFoot", 0), ("LeftToeBase", 1), ("RightFoot", 3), ("RightToeBase", 4)];
|
||||
let mut drift = 0f32;
|
||||
for (name, c) in feet {
|
||||
let k = idx(sk, name);
|
||||
let mut start: Option<usize> = None;
|
||||
for f in 0..=n {
|
||||
let on = f < n && m.contacts[f][c];
|
||||
match (on, start) {
|
||||
(true, None) => start = Some(f),
|
||||
(false, Some(s)) => {
|
||||
let mut far = 0f32;
|
||||
for g in s..f {
|
||||
let d = Vec3::from(j[g][k]) - Vec3::from(j[s][k]);
|
||||
far = far.max(d.x.hypot(d.z));
|
||||
}
|
||||
drift = drift.max(far);
|
||||
start = None;
|
||||
}
|
||||
_ => {}
|
||||
}
|
||||
}
|
||||
}
|
||||
// shoulders above the chest: the highest against the take's own usual, both sides
|
||||
let chest = idx(sk, "Chest");
|
||||
let mut rise = 0f32;
|
||||
for s in ["LeftShoulder", "RightShoulder"] {
|
||||
let k = idx(sk, s);
|
||||
let h: Vec<f32> = j.iter().map(|f| f[k][1] - f[chest][1]).collect();
|
||||
let med = median(h.clone());
|
||||
rise = rise.max(h.iter().fold(f32::MIN, |a, &b| a.max(b)) - med);
|
||||
}
|
||||
// hips below where they stand: the lowest against the first second's median
|
||||
let hips = idx(sk, "Hips");
|
||||
let stand = median(j.iter().take(30).map(|f| f[hips][1]).collect());
|
||||
let drop = (stand - j.iter().fold(f32::MAX, |a, f| a.min(f[hips][1]))).max(0.0);
|
||||
// hands and forearms against the torso (hips to chest, chest to neck) and the head
|
||||
let (spine1, neck, head) = (idx(sk, "Spine1"), idx(sk, "Neck1"), idx(sk, "Head"));
|
||||
let limbs: Vec<usize> = ["LeftHand", "RightHand", "LeftHandMiddle1", "RightHandMiddle1"].iter().map(|x| idx(sk, x)).collect();
|
||||
let fore = [("LeftArm", "LeftForeArm", "LeftHand"), ("RightArm", "RightForeArm", "RightHand")];
|
||||
let mut deep = 0f32;
|
||||
for f in j {
|
||||
let mut pts: Vec<[f32; 3]> = limbs.iter().map(|&k| f[k]).collect();
|
||||
for (_, e, h) in fore {
|
||||
let (a, b) = (f[idx(sk, e)], f[idx(sk, h)]);
|
||||
pts.push([(a[0] + b[0]) / 2.0, (a[1] + b[1]) / 2.0, (a[2] + b[2]) / 2.0]);
|
||||
}
|
||||
for p in pts {
|
||||
let d = inside(p, f[hips], f[spine1], 0.12)
|
||||
.max(inside(p, f[spine1], f[chest], 0.13))
|
||||
.max(inside(p, f[chest], f[neck], 0.11))
|
||||
.max(inside(p, f[head], f[head], 0.09));
|
||||
deep = deep.max(d);
|
||||
}
|
||||
}
|
||||
let (d, r, h, c) = (drift * 100.0, rise * 100.0, drop * 100.0, deep * 100.0);
|
||||
Score { foot_drift_cm: d, shoulder_rise_cm: r, hip_drop_cm: h, collision_cm: c, total: d / 1.0 + r / 3.0 + h / 5.0 + c / 1.0 }
|
||||
}
|
||||
|
||||
impl Score {
|
||||
pub fn line(&self) -> String {
|
||||
format!(
|
||||
"score {:.2} (foot drift {:.1} cm, shoulder rise {:.1} cm, hip drop {:.1} cm, hand into body {:.1} cm)",
|
||||
self.total, self.foot_drift_cm, self.shoulder_rise_cm, self.hip_drop_cm, self.collision_cm
|
||||
)
|
||||
}
|
||||
}
|
||||
+2
-2
@@ -139,8 +139,8 @@ Feature: The Linux engine, as fast as it can be in the cloud
|
||||
Scenario: LX7. The clipping check never makes a render wait
|
||||
Given the plan
|
||||
| crate | file | lines | job |
|
||||
| raea-sys-clip | systems/clip/src/broad.rs | 160 | a broad phase before the voxels: parts whose boxes don't touch on a frame are never voxelized or tested; a part's voxels kept by its shape and scale, so an unchanged part is voxelized once a render |
|
||||
| raea-sys-clip | systems/clip/src/lib.rs | 178 | the frames checked on the cores the render leaves idle: Clipping takes each frame as it's drawn since SG4a (docs/stage-guards.feature), so off the render's thread. The clipping check moves here from raea-sys-contact's clip.rs (11-29: contact plus a broad phase would pass 2000 lines), using contact's deepest, Hit and solid cache as its public interface |
|
||||
| raea-sys-contact | systems/contact/src/broad.rs | 160 | a broad phase before the voxels: parts whose boxes don't touch on a frame are never voxelized or tested; a part's voxels kept by its shape and scale, so an unchanged part is voxelized once a render |
|
||||
| raea-sys-contact | systems/contact/src/clip.rs | 178 | the frames checked on the cores the render leaves idle: Clipping takes each frame as it's drawn since SG4a (docs/stage-guards.feature), so off the render's thread |
|
||||
Then edit.tsx's clipping check takes at most its frames' own time (from 96.1 s), and RR0's film's at most 300 ms
|
||||
And a render's wall with the check on is within 3% of RAEA_CLIP_CHECK=0
|
||||
And the findings are identical on the RR0 film, edit.tsx and the contact fixtures (systems/contact's tests)
|
||||
|
||||
@@ -12,7 +12,7 @@ Body motion made on this machine by Kimodo (NVIDIA), on MLX on a Mac and on PyTo
|
||||
## Usage
|
||||
|
||||
```sh
|
||||
raea motion "LINE" [--keys KEYS.json] [--seconds 5 | --frames N] [--seed 1] [--seeds 1] [--steps 100] [-o CLIP.json] (body motion made on this machine by Kimodo (NVIDIA): a SOMA clip from a line of words and, with --keys, Kimodo constraints (full-body keyframes, hand or foot targets, a root path, as sdk/body/tools/between.ts writes them), as the clip sdk/body/tools/fromkimodo.ts reads. On a Mac it runs on MLX (Apple silicon's GPU): the first use fetches the motion model (1.1 GB) into raea's models folder, and the first new line its text encoder (8.8 GB: Llama 3 8B in 8 bits with LLM2Vec's adapters). On Linux and Windows it runs upstream Kimodo on PyTorch, set up once by raea setup motion: on an NVIDIA GPU with CUDA (the text encoder, 16 GB in bf16, on the CPU unless the card has 18 GB or more), else on the CPU alone; reading a new line on the CPU takes about 18 GB of memory. A line's words are read once and kept. --seeds N makes N takes (seeds SEED to SEED+N-1) and keeps the one with the fewest faults: a foot sliding while planted, the shoulders shrugging, the hips sinking, a hand or forearm into the torso or head (a skeletal check; each take's score is printed and the kept one's written into the clip). Licences: Kimodo's weights NVIDIA's Open Model License, Meta Llama 3 the Meta Llama 3 Community License, LLM2Vec's adapters MIT, Kimodo's code Apache-2.0)
|
||||
raea motion "LINE" [--keys KEYS.json] [--seconds 5 | --frames N] [--seed 1] [--steps 100] [-o CLIP.json] (body motion made on this machine by Kimodo (NVIDIA): a SOMA clip from a line of words and, with --keys, Kimodo constraints (full-body keyframes, hand or foot targets, a root path, as sdk/body/tools/between.ts writes them), as the clip sdk/body/tools/fromkimodo.ts reads. On a Mac it runs on MLX (Apple silicon's GPU): the first use fetches the motion model (1.1 GB) into raea's models folder, and the first new line its text encoder (8.8 GB: Llama 3 8B in 8 bits with LLM2Vec's adapters). On Linux and Windows it runs upstream Kimodo on PyTorch, set up once by raea setup motion: on an NVIDIA GPU with CUDA (the text encoder, 16 GB in bf16, on the CPU unless the card has 18 GB or more), else on the CPU alone; reading a new line on the CPU takes about 18 GB of memory. A line's words are read once and kept. Licences: Kimodo's weights NVIDIA's Open Model License, Meta Llama 3 the Meta Llama 3 Community License, LLM2Vec's adapters MIT, Kimodo's code Apache-2.0)
|
||||
```
|
||||
|
||||
Headless: it needs nothing running and opens no window. Takes up to 1 argument besides its flags.
|
||||
@@ -21,11 +21,10 @@ Headless: it needs nothing running and opens no window. Takes up to 1 argument b
|
||||
|
||||
| Flag | Takes | What it does |
|
||||
| --- | --- | --- |
|
||||
| `--frames` | `N` | The clip's length in frames at 30 a second, 2 to 300 (10 s, Kimodo's limit: longer clips drift and break up; chain 10 s clips through `--keys` instead). Instead of `--seconds`. |
|
||||
| `--frames` | `N` | The clip's length in frames at 30 a second, 2 to 600. Instead of `--seconds`. |
|
||||
| `--keys` | `KEYS.json` | Kimodo constraints the motion must meet: full-body keyframes, a hand or foot at a place on a frame, a path for the hips. `bun sdk/body/tools/between.ts` writes them between two poses of the body library. |
|
||||
| `--seconds` | `5` | The clip's length in seconds (5 unless said). |
|
||||
| `--seed` | `1` | Which of the motions the line could be: another seed is another take of the same line. A seed on MLX is not that seed on PyTorch (the noise is drawn differently), so the same seed is a different take on a Mac and on Linux or Windows. |
|
||||
| `--seeds` | `1` | How many takes to make, seeds `--seed` up: the one with the lowest score is kept and its score written into the clip (`score`: foot drift while a foot is planted, shoulder rise above the take's usual, hip drop below standing, and how far a hand or forearm goes into the torso or head, in cm, summed over allowances of 1, 3, 5 and 1 cm). The collision is a skeletal check, capsules sized for SOMA's average adult, not the body's mesh. |
|
||||
| `--steps` | `100` | Denoising steps (Kimodo's 100). Fewer is faster and rougher. |
|
||||
| `-o` | `CLIP.json` | Where the clip goes: `{fps, names, root, turns, contacts, ...}`, Kimodo's 77 SOMA joints as each one's turn in the world from the T-pose. Without it, the line's words name the file in the working folder. |
|
||||
|
||||
@@ -41,16 +40,6 @@ bun sdk/body/tools/between.ts skeleton.json LIBDIR aMale2_A1_Stand:0 aMale2_A1_S
|
||||
raea motion "A person waves at the camera with their right hand" --keys stand.json --seconds 4 --seed 2 -o wave.clip.json
|
||||
```
|
||||
|
||||
The best of four takes of a line, by the faults a body would show:
|
||||
|
||||
```sh
|
||||
raea motion "A person stands in place and talks, gesturing with both hands" --seconds 10 --seeds 4 -o talk.clip.json
|
||||
```
|
||||
|
||||
Longer than 10 s, make 10 s clips one after another, each with `--keys` holding the last second of the one before as
|
||||
full-body keyframes, and ease each into the next over those frames: Kimodo keeps full-body keys to a few centimetres,
|
||||
not exactly, so a clip cut straight onto the next would jump.
|
||||
|
||||
A clip takes about 8 seconds on an M5 Pro. `bun sdk/body/tools/makedo.ts` does the whole of it for a stage's lines:
|
||||
three seeds a line, each checked against the captures the body hands on to, and the one that does the most kept in the
|
||||
project's made clips.
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
#!/bin/bash
|
||||
# The models raea runs on Linux, from this Mac into the Modal volume raea-models (docs/cloud-render.md, "Models"), for
|
||||
# the farm's GPUs and a cloud box to mount instead of fetching them on each cold start:
|
||||
# (what's here is the cloud side of zoo/zoo.tsv: every model sent has a cloud row there, zoo/README.md)
|
||||
#
|
||||
# MODAL_PROFILE=raea deploy/modal/models.sh # stage and upload
|
||||
# deploy/modal/models.sh --dry # stage only, and list what would go
|
||||
|
||||
@@ -20,11 +20,6 @@ anyhow = "1"
|
||||
# models fetched once from Hugging Face into the model cache (models.rs)
|
||||
ureq = "2"
|
||||
|
||||
# ureq is used by zoo/rust/models.rs, which src/lib.rs takes in through #[path] from the zoo (zoo/README.md), where
|
||||
# cargo-shear doesn't look
|
||||
[package.metadata.cargo-shear]
|
||||
ignored = ["ureq"]
|
||||
|
||||
# Windows x64: ONNX Runtime is loaded from onnxruntime.dll beside the executable when a model first runs, never linked
|
||||
# in (#110; tools/release/onnxruntime.sh ships Microsoft's build). The static runtime ort downloads is built for AVX2, and
|
||||
# its static initializers ran before main, so raea.exe stopped at start on any CPU without AVX2 or BMI2.
|
||||
|
||||
@@ -31,8 +31,6 @@ use ort::value::{DynValue, Tensor as OrtTensor, TensorElementType, ValueType};
|
||||
pub use half;
|
||||
pub mod feed;
|
||||
mod jobs;
|
||||
// the model zoo's Rust API lives with the zoo (zoo/README.md): raea_sys_ml::models is zoo/rust/models.rs
|
||||
#[path = "../../../zoo/rust/models.rs"]
|
||||
pub mod models;
|
||||
|
||||
pub use jobs::{job_key, poll, request, result};
|
||||
|
||||
@@ -1,6 +1,3 @@
|
||||
//! raea's model zoo from Rust (zoo/README.md; built into raea-sys-ml as raea_sys_ml::models). Every model a crate
|
||||
//! loads has its rows in zoo/zoo.tsv, one per target; zoo/check.sh fails on a model id in code that no row names.
|
||||
//!
|
||||
//! Where models' weights live: ~/.cache/raea-feed/models/<name>/ (feed::cache), each file fetched once from Hugging
|
||||
//! Face. RAEA_FEED_MODELS points somewhere else (a bench, a bundled app).
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
# The models a release packs, downloaded by .github/workflows/release.yml into ~/.local/share/raea-models (path, URL,
|
||||
# sha256; tab-separated). The URL is an asset of the public repository's models-1 release, uploaded once at the cutover
|
||||
# (docs/public-first.feature PF5); the sha256 is of the copy tools/release.sh packs on the release Mac.
|
||||
# Each model packed here has its desktop rows in zoo/zoo.tsv (zoo/README.md): the zoo says what runs where, this says how it ships.
|
||||
# Beat This! small0 (MIT, github.com/CPJKU/beat_this), converted to ONNX for raea song
|
||||
beat-this/beat_this_small0.onnx https://github.com/shinyobjectz/raea/releases/download/models-1/beat_this_small0.onnx 3f650a9f36d708d575808220a2874b0b84cf402db645b7eac2d9069a53642d4b
|
||||
# raea fix's library (systems/fixes): ~46,500 problem -> fix entries from MIT, Apache-2.0, BSD, CC0 and ClawHub (MIT-0)
|
||||
|
||||
|
@@ -1,70 +0,0 @@
|
||||
# zoo: every model raea runs, managed in one place
|
||||
|
||||
Shane, 12-06: one place for every model, split by where it's delivered, so no one confuses again where a model runs
|
||||
or where it's referenced. The targets can differ completely (model, size, quantisation, runtime), but they're managed
|
||||
here, side by side.
|
||||
|
||||
| file | what |
|
||||
|---|---|
|
||||
| `zoo.tsv` | the catalog: one row per model and target. Nothing about a model (weights, runtime, where it lives, licence) is written down anywhere else |
|
||||
| `check.sh` | the rules below, checked; `--code` also lists model ids in code that no row names |
|
||||
| `python/raea_zoo.py` | the Python API: which model this target runs, from where, on what device; refuses a model with no row |
|
||||
| `rust/models.rs` | the Rust API, built into `raea-sys-ml` as `raea_sys_ml::models` (fetch once, the model folders) |
|
||||
|
||||
## Targets
|
||||
|
||||
| target | what it is | where models live |
|
||||
|---|---|---|
|
||||
| `cloud` | Modal: the render farm and cloud boxes (`sdk/cloud/deploy/modal`), and projects' Modal apps (unrender's `raea-unrender`) | volume `raea-models` (`/raea`, `/feed`, `/library`, uploaded by `sdk/cloud/deploy/modal/models.sh`); a project's own volumes |
|
||||
| `mac` | the desktop app and CLI on Apple silicon: Core ML and MLX allowed | `~/.local/share/raea-models` (perception), `~/.cache/raea-feed/models` (fetched on first use), `~/.raea/models` (the app library) |
|
||||
| `windows` | the desktop app and CLI on Windows | the same folders, ONNX Runtime from `onnxruntime.dll` beside the exe |
|
||||
| `linux` | the CLI on Linux | the same folders |
|
||||
|
||||
`desktop` in a row means mac+windows+linux with one build. Split it the moment one OS runs something different.
|
||||
|
||||
## Rules
|
||||
|
||||
1. **A model runs only if it has a row for the target it runs on.** Code asks the zoo (`raea_zoo.use(key)` from
|
||||
Python; the Rust API's folders from Rust). A model id in code with no row fails `check.sh --code --strict`.
|
||||
2. **Every model says something for every target.** Each key's rows cover cloud, mac, windows and linux once each. A
|
||||
target it never runs on gets a row with state `none` and why. A project that is cloud-and-Mac only says so once in a
|
||||
`project/*` row.
|
||||
3. **Parity: a change on one target is decided on the others.** All of a key's rows carry the same `reviewed` date.
|
||||
Change the cloud row and the check fails until you've looked at the desktop rows and dated them too: the same
|
||||
model, a different build (MLX for CUDA, int8 for bf16), or `none` or `planned` with the reason. Desktop work owes the
|
||||
cloud the same. A note with `parity owed` lists what's still open; `check.sh` prints them.
|
||||
4. **Delivery stays in its one place.** What a release packs is `tools/release/models.tsv` (URL and sha256); what goes
|
||||
up to Modal is `sdk/cloud/deploy/modal/models.sh`. Both carry only models with a row here for that target.
|
||||
|
||||
## Columns of zoo.tsv
|
||||
|
||||
`key targets state runtime weights where licence reviewed note`, tab-separated.
|
||||
|
||||
- **key**: `project/model`. `raea/...` is the engine and its apps; `unrender/...` is `projects/unrender` in the
|
||||
workspace repo (raea-2). The same weights used by two projects are two keys: each project decides its own targets.
|
||||
- **state**: `ships` (in a release or a deploy), `dev` (a project's pipeline), `bench` (a bake-off arm), `planned`,
|
||||
`none`, `found` (in code, use not traced yet).
|
||||
- **reviewed**: the date a person last decided the key on every target, or `unverified` (filled in from code without
|
||||
checking every target; the check counts them, and each one is worth tracing).
|
||||
|
||||
## Using it
|
||||
|
||||
```bash
|
||||
zoo/check.sh --code # the rules, and model ids in code with no row
|
||||
python3 zoo/python/raea_zoo.py unrender # unrender's models on this machine
|
||||
python3 zoo/python/raea_zoo.py unrender --target cloud
|
||||
```
|
||||
|
||||
```python
|
||||
sys.path.insert(0, os.environ.get("RAEA_ZOO", os.path.expanduser("~/raea/zoo")) + "/python")
|
||||
import raea_zoo as zoo
|
||||
row = zoo.use("unrender/whisper") # this target's row; RuntimeError if it doesn't run here
|
||||
dev = zoo.device() # cuda in the cloud, mps on a Mac
|
||||
```
|
||||
|
||||
A Modal image that runs zoo-managed code adds the folder: `.add_local_dir(Path.home() / "raea" / "zoo", "/root/zoo")`
|
||||
and `RAEA_ZOO=/root/zoo`.
|
||||
|
||||
Not models, so not here: data files that ship beside them (`fixes/fixes-library.db`, packed by the release), and chat or
|
||||
image services reached over the network (Gemini, GPT, fal), which are the providers'. Hosted models we call for a
|
||||
pipeline result (Whisper on OpenRouter or Groq) are rows, with their target's `where` naming the provider.
|
||||
@@ -1,82 +0,0 @@
|
||||
#!/bin/bash
|
||||
# zoo/check.sh: the zoo's rules (zoo/README.md), checked on zoo/zoo.tsv.
|
||||
#
|
||||
# zoo/check.sh the rules: fails on a broken one
|
||||
# zoo/check.sh --code also lists model ids found in code (raea, and projects/unrender when it's here) that no
|
||||
# row names; --strict makes any of those a failure too
|
||||
#
|
||||
# Rules: every row has 9 columns, known targets and a known state; each key's rows (with its project's project/* row
|
||||
# for the targets they leave) cover cloud, mac, windows and linux once each; all of a key's own rows carry the same
|
||||
# reviewed value (the parity rule: a change on one target is decided on the others the same day).
|
||||
set -euo pipefail
|
||||
here=$(cd "$(dirname "$0")" && pwd)
|
||||
tsv="$here/zoo.tsv"
|
||||
code=0 strict=0
|
||||
for a in "$@"; do
|
||||
case $a in --code) code=1 ;; --strict) code=1 strict=1 ;; *) echo "zoo/check.sh: unknown flag $a" >&2; exit 2 ;; esac
|
||||
done
|
||||
|
||||
awk -F'\t' '
|
||||
function expand(t, n, i, p, out) {
|
||||
gsub(/desktop/, "mac+windows+linux", t); n = split(t, p, "+"); out = ""
|
||||
for (i = 1; i <= n; i++) { if (!(p[i] in OK)) return "?" p[i]; out = out " " p[i] }
|
||||
return out
|
||||
}
|
||||
BEGIN { OK["cloud"]; OK["mac"]; OK["windows"]; OK["linux"]
|
||||
ST["ships"]; ST["dev"]; ST["planned"]; ST["none"]; ST["found"]; ST["bench"]; bad = 0 }
|
||||
/^#/ || NF == 0 { next }
|
||||
{
|
||||
if (NF != 9) { printf "zoo: line %d (%s) has %d columns, not 9\n", NR, $1, NF; bad = 1; next }
|
||||
key = $1; t = expand($2)
|
||||
if (t ~ /\?/) { printf "zoo: line %d (%s): unknown target %s\n", NR, key, substr(t, index(t, "?") + 1); bad = 1; next }
|
||||
if (!($3 in ST)) { printf "zoo: line %d (%s): unknown state %s\n", NR, key, $3; bad = 1 }
|
||||
if ($8 != "unverified" && $8 !~ /^20[0-9][0-9]-[01][0-9]-[0-3][0-9]$/) { printf "zoo: line %d (%s): reviewed is %s, not a date or unverified\n", NR, key, $8; bad = 1 }
|
||||
if ($8 == "unverified") unv[key] = 1
|
||||
if ($9 ~ /parity owed/) owed[key] = $9
|
||||
n = split(t, ts, " ")
|
||||
split(key, kp, "/")
|
||||
for (i = 1; i <= n; i++) {
|
||||
if (kp[2] == "*") { wild[kp[1], ts[i]] = 1; continue }
|
||||
if ((key, ts[i]) in cov) { printf "zoo: %s covers %s twice (line %d)\n", key, ts[i], NR; bad = 1 }
|
||||
cov[key, ts[i]] = 1
|
||||
}
|
||||
if (kp[2] != "*") {
|
||||
keys[key] = kp[1]
|
||||
if (key in rev && rev[key] != $8) { printf "zoo: %s: reviewed %s on line %d but %s above: decide every target the same day (parity rule)\n", key, $8, NR, rev[key]; bad = 1 }
|
||||
rev[key] = $8
|
||||
}
|
||||
}
|
||||
END {
|
||||
for (k in keys) for (o in OK) if (!((k, o) in cov) && !((keys[k], o) in wild)) { printf "zoo: %s says nothing for %s: add a row (state none, with why, if it never runs there)\n", k, o; bad = 1 }
|
||||
nk = 0; for (k in keys) nk++
|
||||
nu = 0; for (k in unv) nu++
|
||||
printf "zoo: %d models, %d still unverified", nk, nu
|
||||
no = 0; for (k in owed) no++
|
||||
printf ", %d with parity owed\n", no
|
||||
for (k in owed) printf " parity owed: %s: %s\n", k, owed[k]
|
||||
exit bad
|
||||
}
|
||||
' "$tsv"
|
||||
|
||||
[ $code = 1 ] || exit 0
|
||||
|
||||
# model ids in code that no row's weights column names: Hugging Face repo ids, and folders of the perception store
|
||||
listed=$(awk -F'\t' '!/^#/ && NF { print $5 " " $6 }' "$tsv")
|
||||
roots=()
|
||||
raea=$(cd "$here/.." && pwd)
|
||||
for d in systems io runtime engine apps sdk core; do [ -d "$raea/$d" ] && roots+=("$raea/$d"); done
|
||||
unrender=${UNRENDER:-$HOME/Documents/raea/raea/projects/unrender}
|
||||
for d in footage tools people; do [ -d "$unrender/$d" ] && roots+=("$unrender/$d"); done
|
||||
orgs='onnx-community|Xenova|mlx-community|facebook|microsoft|google|openai|Qwen|nvidia|kyutai|istupakov|Ruicheng|unsloth|depth-anything|ByteDance|meta-llama|CPJKU|pipecat-ai|apple|pyannote'
|
||||
missing=$(grep -rhoE "\"($orgs)/[A-Za-z0-9._-]+\"" --include='*.rs' --include='*.ts' --include='*.py' --include='*.sh' \
|
||||
--exclude-dir=node_modules --exclude-dir=target --exclude-dir=vendor --exclude-dir=.venv "${roots[@]}" 2>/dev/null |
|
||||
tr -d '"' | sort -u | while read -r id; do grep -qF "$id" <<<"$listed" || echo "$id"; done)
|
||||
# chat and image APIs reached over the network are services, not models we deliver
|
||||
missing=$(grep -vE '^(google/gemini|openai/gpt|fal-ai/)' <<<"$missing" || true)
|
||||
if [ -n "$missing" ]; then
|
||||
echo "zoo: in code, named by no row:"
|
||||
sed 's/^/ /' <<<"$missing"
|
||||
[ $strict = 0 ] || exit 1
|
||||
else
|
||||
echo "zoo: every model id in code is in the zoo"
|
||||
fi
|
||||
@@ -1,111 +0,0 @@
|
||||
"""raea's model zoo from Python: the one way Python code asks which model it runs here, from where, and on what device
|
||||
(zoo/README.md). Everything comes from zoo/zoo.tsv; nothing about a model is written down anywhere else.
|
||||
|
||||
import raea_zoo as zoo # sys.path gets $RAEA_ZOO/python (default ~/raea/zoo/python)
|
||||
zoo.target() # "cloud", "mac", "windows" or "linux"
|
||||
zoo.entry("unrender/whisper") # this target's row: runtime, weights, where, licence, state, ...
|
||||
zoo.use("unrender/whisper") # refuses a model with no row here, or one whose row here says none; logs the use
|
||||
zoo.device() # torch device for this target: cuda in the cloud, mps on a Mac, else cuda or cpu
|
||||
zoo.models("unrender") # {name: row} of a project's models on this target
|
||||
|
||||
python3 zoo/python/raea_zoo.py [PROJECT|KEY ...] [--target T] the rows for a target (default: this machine's)
|
||||
|
||||
The target: RAEA_TARGET if set; cloud inside a Modal container (MODAL_TASK_ID) or with UNRENDER_IN_CLOUD=1; else the
|
||||
machine's OS. A use is logged as a JSON line to $RAEA_ZOO_LOG when it's set (a project points it at a per-run file).
|
||||
"""
|
||||
import json, os, platform, sys, time
|
||||
from pathlib import Path
|
||||
|
||||
ZOO = Path(os.environ.get("RAEA_ZOO") or Path(__file__).resolve().parent.parent)
|
||||
TSV = ZOO / "zoo.tsv"
|
||||
COLS = ["key", "targets", "state", "runtime", "weights", "where", "licence", "reviewed", "note"]
|
||||
TARGETS = ("cloud", "mac", "windows", "linux")
|
||||
_rows = None
|
||||
|
||||
|
||||
def target():
|
||||
t = os.environ.get("RAEA_TARGET")
|
||||
if t:
|
||||
assert t in TARGETS, f"RAEA_TARGET={t}: one of {TARGETS}"
|
||||
return t
|
||||
if os.environ.get("MODAL_TASK_ID") or os.environ.get("UNRENDER_IN_CLOUD") == "1":
|
||||
return "cloud"
|
||||
return {"Darwin": "mac", "Windows": "windows"}.get(platform.system(), "linux")
|
||||
|
||||
|
||||
def _targets(s):
|
||||
return set(s.replace("desktop", "mac+windows+linux").split("+"))
|
||||
|
||||
|
||||
def rows():
|
||||
global _rows
|
||||
if _rows is None:
|
||||
_rows = []
|
||||
for ln in TSV.read_text().splitlines():
|
||||
if not ln.strip() or ln.startswith("#"):
|
||||
continue
|
||||
r = dict(zip(COLS, ln.split("\t")))
|
||||
r["targets"] = _targets(r["targets"])
|
||||
_rows.append(r)
|
||||
return _rows
|
||||
|
||||
|
||||
def entry(key, on=None):
|
||||
"""key's row for target `on` (default this one): its own row, else its project's project/* row"""
|
||||
on = on or target()
|
||||
own = [r for r in rows() if r["key"] == key]
|
||||
if not own:
|
||||
raise KeyError(f"{key} isn't in the zoo ({TSV}): add its rows for every target before it runs")
|
||||
for r in own + [r for r in rows() if r["key"] == key.split("/")[0] + "/*"]:
|
||||
if on in r["targets"]:
|
||||
return r
|
||||
raise KeyError(f"{key} has no row for {on} in {TSV}")
|
||||
|
||||
|
||||
def use(key, on=None):
|
||||
"""the row this target runs key with; refuses a key not in the zoo, or one whose row here is state none"""
|
||||
r = entry(key, on)
|
||||
if r["state"] == "none":
|
||||
raise RuntimeError(f"{key} doesn't run on {on or target()} ({r['note'] or 'state none in the zoo'})")
|
||||
log = os.environ.get("RAEA_ZOO_LOG")
|
||||
if log:
|
||||
with open(log, "a") as f:
|
||||
f.write(json.dumps({"model": key, "on": on or target(), "by": Path(sys.argv[0]).name, "t": round(time.time())}) + "\n")
|
||||
return r
|
||||
|
||||
|
||||
def models(project, on=None):
|
||||
"""{name: row} of a project's models that have a row (not none) on this target"""
|
||||
out = {}
|
||||
for k in dict.fromkeys(r["key"] for r in rows() if r["key"].startswith(project + "/") and not r["key"].endswith("/*")):
|
||||
r = entry(k, on)
|
||||
if r["state"] != "none":
|
||||
out[k.split("/", 1)[1]] = r
|
||||
return out
|
||||
|
||||
|
||||
def device(mac="mps"):
|
||||
"""the torch device for this target: CUDA in the cloud; on a Mac what the caller asks for (mps), if it's there"""
|
||||
import torch
|
||||
if torch.cuda.is_available():
|
||||
return "cuda"
|
||||
if target() == "mac" and mac == "mps" and torch.backends.mps.is_available():
|
||||
return "mps"
|
||||
return "cpu"
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
args = sys.argv[1:]
|
||||
on = None
|
||||
if "--target" in args:
|
||||
i = args.index("--target")
|
||||
on = args[i + 1]
|
||||
del args[i:i + 2]
|
||||
on = on or target()
|
||||
keys = dict.fromkeys(r["key"] for r in rows() if not r["key"].endswith("/*"))
|
||||
if args:
|
||||
keys = [k for k in keys if any(k == a or k.startswith(a + "/") for a in args)]
|
||||
print(f"target {on} ({TSV})")
|
||||
for k in keys:
|
||||
r = entry(k, on)
|
||||
print(f" {k:28} {r['state']:8} {r['runtime'][:60]:60} {r['weights'][:50]}")
|
||||
-106
@@ -1,106 +0,0 @@
|
||||
# raea's model zoo: every model raea and its projects run, one row per model and target (zoo/README.md has the rules).
|
||||
# Columns, tab-separated: key targets state runtime weights where licence reviewed note
|
||||
# key project/model (raea/... is the engine; unrender/... is projects/unrender in raea-2); project/* is every model of the project
|
||||
# targets cloud, mac, windows, linux joined with +; desktop = mac+windows+linux. A key's rows cover all four, once each
|
||||
# state ships (in a release or a deploy) dev (a project's pipeline) bench (a bake-off arm, not in the pipeline) planned none (not on that target: the note says why) found (in code, use not traced)
|
||||
# reviewed the date a person last decided this key on every target; all of a key's rows carry the same one (the parity rule), or unverified
|
||||
#
|
||||
# --- unrender (projects/unrender, raea-2): the scene record. Cloud = footage/cloud.py, one ephemeral Modal app raea-unrender on an L40S (UNRENDER_IN_CLOUD=1)
|
||||
unrender/* windows+linux none - - - - 2026-12-06 unrender runs on Modal and the Mac only (Shane 12-06: every model on Modal for now)
|
||||
unrender/transnetv2 cloud dev ONNX Runtime CUDA, footage/portable.py (port of raea song's transnet.rs) transnetv2.onnx (soCzech/TransNetV2 @85cef72) volume raea-unrender-models:/raea-models/transnetv2 MIT 2026-12-06 matches the Mac to 0.007, same peaks (gt-dev-0)
|
||||
unrender/transnetv2 mac dev raea-perceive transnet (Rust, ONNX Runtime) transnetv2.onnx ~/.local/share/raea-models/transnetv2 MIT 2026-12-06
|
||||
unrender/autoshot cloud dev PyTorch CUDA (footage/autoshot.py) autoshot-pytorch-weights.pth (ShotBench) volume raea-unrender-models:/raea-models/autoshot Apache-2.0 2026-12-06
|
||||
unrender/autoshot mac dev PyTorch CPU autoshot-pytorch-weights.pth ~/.local/share/raea-models/autoshot Apache-2.0 2026-12-06
|
||||
unrender/whisper cloud dev openai-whisper, CUDA large-v3-turbo volume raea-molmo3:/whisper MIT 2026-12-06
|
||||
unrender/whisper mac dev mlx_whisper (MLX) mlx-community/whisper-large-v3-turbo HF cache MIT 2026-12-06
|
||||
unrender/silero-vad cloud+mac dev silero-vad 6.3 (pip), CPU in the wheel - MIT 2026-12-06
|
||||
unrender/yamnet cloud dev ONNX Runtime CUDA, footage/portable.py yamnet.onnx volume raea-unrender-models:/raea-models/yamnet Apache-2.0 2026-12-06 differs from the Mac's Core ML on borderline music/noise patches
|
||||
unrender/yamnet mac dev raea-perceive sound (Core ML) yamnet.onnx ~/.local/share/raea-models/yamnet Apache-2.0 2026-12-06
|
||||
unrender/resemblyzer cloud dev PyTorch CUDA pretrained.pt (in the wheel) - Apache-2.0 2026-12-06
|
||||
unrender/resemblyzer mac dev PyTorch CPU pretrained.pt (in the wheel) - Apache-2.0 2026-12-06
|
||||
unrender/lr-asd cloud dev PyTorch CUDA pretrain_AVA.model vendor/LR-ASD (in the image) MIT (AVA labels CC BY 4.0) 2026-12-06
|
||||
unrender/lr-asd mac dev PyTorch MPS pretrain_AVA.model vendor/LR-ASD MIT (AVA labels CC BY 4.0) 2026-12-06
|
||||
unrender/rapidocr cloud+mac dev rapidocr_onnxruntime 1.4.4, CPU PP-OCR det + rec (in the wheel) - Apache-2.0 2026-12-06
|
||||
unrender/rtmw-x cloud dev rtmlib 0.0.16, ONNX Runtime CUDA rtmw-dw-x-l 384x288 + yolox_m humanart volume raea-molmo3:/rtmlib Apache-2.0 2026-12-06
|
||||
unrender/rtmw-x mac dev rtmlib, Core ML rtmw-dw-x-l 384x288 + yolox_m humanart ~/.cache/rtmlib Apache-2.0 2026-12-06
|
||||
unrender/yunet cloud dev OpenCV DNN, CPU face_detection_yunet_2023mar.onnx volume raea-unrender-models:/face/yunet MIT 2026-12-06
|
||||
unrender/yunet mac dev OpenCV DNN, CPU face_detection_yunet_2023mar.onnx ~/.cache/raea/yunet MIT 2026-12-06
|
||||
unrender/sface cloud dev OpenCV DNN, CPU face_recognition_sface_2021dec.onnx volume raea-unrender-models:/face/sface Apache-2.0 2026-12-06
|
||||
unrender/sface mac dev OpenCV DNN, CPU face_recognition_sface_2021dec.onnx ~/.cache/raea/sface Apache-2.0 2026-12-06
|
||||
unrender/vjepa cloud dev PyTorch CUDA (footage/camera.py, footage/vjmask.py) V-JEPA 2.1 ViT-B encoder_fp16.pt + camera_heads.npz + code volume raea-unrender-models:/raea-models/vjepa2_1-vitb MIT (heads: CameraBench CC BY 4.0) 2026-12-06
|
||||
unrender/vjepa mac dev PyTorch MPS encoder_fp16.pt + camera_heads.npz ~/.local/share/raea-models/vjepa2_1-vitb MIT (heads: CameraBench CC BY 4.0) 2026-12-06
|
||||
unrender/moge2 cloud dev PyTorch CUDA, in-process (people/moge_modal.py Geo) Ruicheng/moge-2-vitl-normal volume raea-molmo3:/hf MIT 2026-12-06
|
||||
unrender/moge2 mac dev PyTorch MPS (moge_local) Ruicheng/moge-2-vitl-normal HF cache MIT 2026-12-06
|
||||
unrender/qwen3vl-4b cloud dev transformers bf16 CUDA (footage/vlm.py) Qwen/Qwen3-VL-4B-Instruct volume raea-molmo3:/hf Apache-2.0 2026-12-06 on its way out (12-06): the text head moved to SigLIP; left: shot nouns (SigLIP lost, recall 0.44 vs 0.61), text re-read
|
||||
unrender/qwen3vl-4b mac dev mlx-vlm 4-bit (footage/vlm.py) mlx-community/Qwen3-VL-4B-Instruct-4bit HF cache Apache-2.0 2026-12-06 on its way out, as the cloud row
|
||||
unrender/qwen3vl-8b cloud none - Qwen/Qwen3-VL-8B-Instruct - Apache-2.0 2026-12-06 out of the pipeline 12-06: the text head takes a SigLIP 2 crop vector in place of its overlay and screen votes (LOCO 0.922 vs 0.920, RESULTS "12-06 consolidation")
|
||||
unrender/qwen3vl-8b mac none - Qwen/Qwen3-VL-8B-Instruct - Apache-2.0 2026-12-06 out of the pipeline 12-06: the text head takes a SigLIP 2 crop vector in place of its overlay and screen votes (LOCO 0.922 vs 0.920, RESULTS "12-06 consolidation")
|
||||
unrender/sam3.1 cloud dev transformers bf16 CUDA, in-process (tools/sam_modal.py Sam) unsloth/sam3.1 volume raea-molmo3:/hf SAM License 2026-12-06
|
||||
unrender/sam3.1 mac dev remote: Modal app raea-unrender-sam unsloth/sam3.1 Modal SAM License 2026-12-06
|
||||
unrender/sam3-video cloud dev transformers bf16 CUDA, in-process (tools/samv_modal.py Track, Track31) facebook/sam3 + unsloth/sam3.1 volume raea-molmo3:/hf SAM License 2026-12-06
|
||||
unrender/sam3-video mac dev remote: Modal app raea-unrender-samv facebook/sam3 + unsloth/sam3.1 Modal SAM License 2026-12-06
|
||||
unrender/siglip2 cloud dev ONNX Runtime CPU (footage/siglip.py) siglip2-base-p16-224 (onnx-community/siglip2-base-patch16-224-ONNX) volume raea-unrender-models:/raea-models/siglip2-base-p16-224 Apache-2.0 2026-12-06 text head (12-06), likeness
|
||||
unrender/siglip2 mac dev ONNX Runtime CPU (never the Core ML GPU: wrong on the M5) siglip2-base-p16-224 ~/.local/share/raea-models/siglip2-base-p16-224 Apache-2.0 2026-12-06
|
||||
unrender/vggt cloud planned PyTorch CUDA facebook/VGGT-1B-Commercial (gated) - VGGT License (no military use) 2026-12-06 camera path in place of LK (Shane's plan, step 2)
|
||||
unrender/vggt mac planned to decide after the cloud bake-off - - VGGT License (no military use) 2026-12-06 parity owed: MoGe-2 per frame stays the Mac's answer until then
|
||||
unrender/tapnext-pp cloud planned JAX or PyTorch CUDA TAPNext++ 256 / 512 - Apache-2.0 2026-12-06 rotation, spin, squash from points in SAM masks (step 3)
|
||||
unrender/tapnext-pp mac planned to decide after the cloud trial - - Apache-2.0 2026-12-06 parity owed
|
||||
unrender/geo-bench cloud bench PyTorch CUDA (footage/geo/geo_modal.py, footage/geo/bake.py) apple/DepthPro2-B, apple/DepthPro2-focal, depth-anything/DA3-SMALL, depth-anything/DA3-BASE, depth-anything/DA3METRIC-LARGE, depth-anything/Metric-Video-Depth-Anything-Small, facebook/map-anything-apache Modal per model: DA3 Small/Base/Metric Apache-2.0, map-anything-apache Apache-2.0, others unread here unverified depth and camera bake-off arms against MoGe-2
|
||||
unrender/geo-bench mac none - - - - unverified a bake-off on Modal only
|
||||
unrender/sam-3d-body cloud bench PyTorch CUDA (people/sam3db_modal.py) facebook/sam-3d-body-dinov3 Modal SAM License unverified
|
||||
unrender/sam-3d-body mac none - - - - unverified Modal only
|
||||
unrender/qwen2.5-vl-7b cloud bench transformers CUDA (footage/bench_camera_modal.py) Qwen/Qwen2.5-VL-7B-Instruct Modal Apache-2.0 unverified the camera bench's VLM arm
|
||||
unrender/qwen2.5-vl-7b mac none - - - - unverified Modal only
|
||||
#
|
||||
# --- raea (the engine and its apps). Cloud = the render farm and cloud boxes: Modal volume raea-models (/raea perception, /feed, /library),
|
||||
# --- uploaded by sdk/cloud/deploy/modal/models.sh. Desktop = the release (tools/release/models.tsv) or fetched on first use (zoo/rust/models.rs)
|
||||
raea/beat-this cloud ships ONNX Runtime (farm) beat_this_small0.onnx (CPJKU/beat_this small0, converted) volume raea-models:/raea/beat-this MIT 2026-12-06
|
||||
raea/beat-this desktop ships ONNX Runtime (systems/song beatthis.rs) beat_this_small0.onnx ~/.local/share/raea-models/beat-this; packed by tools/release/models.tsv MIT 2026-12-06
|
||||
raea/transnetv2 cloud ships ONNX Runtime (farm) transnetv2.onnx volume raea-models:/raea/transnetv2 MIT 2026-12-06
|
||||
raea/transnetv2 desktop ships ONNX Runtime (systems/song transnet.rs) transnetv2.onnx ~/.local/share/raea-models/transnetv2 MIT 2026-12-06 how a fresh install gets it is unchecked (not in tools/release/models.tsv)
|
||||
raea/htdemucs cloud ships ONNX Runtime (farm) htdemucs_core.onnx volume raea-models:/raea/htdemucs MIT 2026-12-06
|
||||
raea/htdemucs desktop ships ONNX Runtime (systems/song stems.rs) htdemucs_core.onnx ~/.local/share/raea-models/htdemucs MIT 2026-12-06 how a fresh install gets it is unchecked
|
||||
raea/silero-vad cloud ships ONNX Runtime (farm) silero_vad.onnx volume raea-models:/raea/silero-vad and /feed/silero-vad MIT 2026-12-06
|
||||
raea/silero-vad desktop ships ONNX Runtime (systems/song vad.rs, apps/voice turns.rs) silero_vad.onnx ~/.local/share/raea-models/silero-vad MIT 2026-12-06
|
||||
raea/yamnet cloud ships ONNX Runtime (farm) yamnet.onnx volume raea-models:/raea/yamnet Apache-2.0 unverified
|
||||
raea/yamnet mac ships Core ML (perception sound) and ONNX Runtime (systems/columns) yamnet.onnx ~/.local/share/raea-models/yamnet; else fetched once from the public repo's models-1 Apache-2.0 unverified
|
||||
raea/yamnet windows+linux ships ONNX Runtime (systems/columns) yamnet.onnx fetched once from the public repo's models-1 Apache-2.0 unverified
|
||||
raea/siglip2-224 cloud ships ONNX Runtime onnx-community/siglip2-base-patch16-224-ONNX (vision fp32, text fp16) volume raea-models:/feed (models.sh --all), else fetched on first use Apache-2.0 2026-12-06
|
||||
raea/siglip2-224 desktop ships ONNX Runtime (systems/columns models.rs) onnx-community/siglip2-base-patch16-224-ONNX ~/.cache/raea-feed/models/siglip2-base-p16-224 (fetched on first use) Apache-2.0 2026-12-06
|
||||
raea/clap cloud ships ONNX Runtime Xenova/clap-htsat-unfused (q8; fp32 for benches) volume raea-models:/feed (models.sh --all), else fetched on first use Apache-2.0 2026-12-06
|
||||
raea/clap desktop ships ONNX Runtime (systems/columns models.rs) Xenova/clap-htsat-unfused (q8; fp32 for benches) ~/.cache/raea-feed/models/clap-htsat-unfused Apache-2.0 2026-12-06
|
||||
raea/embeddinggemma-2 cloud ships ONNX Runtime onnx-community/embeddinggemma-2-ONNX (quantized) volume raea-models:/library (models.sh --all) Gemma terms 2026-12-06
|
||||
raea/embeddinggemma-2 desktop ships ONNX Runtime (systems/columns models.rs, the app library) onnx-community/embeddinggemma-2-ONNX (quantized) ~/.raea/models or the feed cache Gemma terms 2026-12-06
|
||||
raea/parakeet cloud ships ONNX Runtime istupakov/parakeet-tdt-0.6b-v3-onnx (int8) volume raea-models:/feed (models.sh --all) CC BY 4.0 2026-12-06
|
||||
raea/parakeet desktop ships ONNX Runtime (apps/voice asr.rs) istupakov/parakeet-tdt-0.6b-v3-onnx (int8) ~/.cache/raea-feed/models/parakeet-tdt-0.6b-v3 CC BY 4.0 2026-12-06
|
||||
raea/pocket-tts cloud ships ONNX Runtime kyutai/pocket-tts-without-voice-cloning english_2026-04 (int8) + voice embeddings; mlx-community/pocket-tts tokenizer volume raea-models:/feed (models.sh --all) unread here 2026-12-06
|
||||
raea/pocket-tts desktop ships ONNX Runtime (systems/speech pocket) kyutai/pocket-tts-without-voice-cloning english_2026-04 (int8) + voice embeddings; mlx-community/pocket-tts tokenizer ~/.cache/raea-feed/models/pocket-tts unread here 2026-12-06
|
||||
raea/smart-turn cloud ships ONNX Runtime smart-turn-v3 volume raea-models:/feed (models.sh --all) unread here unverified
|
||||
raea/smart-turn desktop ships ONNX Runtime (apps/voice) smart-turn-v3 ~/.cache/raea-feed/models/smart-turn-v3 unread here unverified
|
||||
raea/trustmark cloud ships ONNX Runtime TrustMark encoder_Q / decoder_Q volume raea-models:/library/trustmark MIT 2026-12-06
|
||||
raea/trustmark desktop ships ONNX Runtime (io/provenance mark.rs) TrustMark encoder_Q / decoder_Q ~/.raea/models/trustmark MIT 2026-12-06
|
||||
raea/rtdetr-v2 cloud+desktop ships ONNX Runtime (engine/neural score.rs) onnx-community/rtdetr_v2_r18vd-ONNX fetched on first use Apache-2.0 unverified where the farm runs it is unchecked
|
||||
raea/kimodo cloud+desktop ships PyTorch in a uv environment (systems/kimodo torch.rs: the CUDA build where there's an NVIDIA driver, else CPU) nvidia/Kimodo-SOMA-RP-v1 ~/.cache/raea-feed/models/kimodo (+ kimodo-torch) unread here unverified
|
||||
raea/kimodo-text mac ships MLX 8-bit (systems/kimodo) mlx-community/Meta-Llama-3-8B-Instruct-8bit ~/.cache/raea-feed/models/kimodo-text Llama 3 licence unverified
|
||||
raea/kimodo-text cloud+windows+linux ships PyTorch (systems/kimodo torch/run.py) meta-llama/Meta-Llama-3-8B-Instruct HF cache Llama 3 licence unverified
|
||||
raea/mediapipe mac ships Core ML (systems/vision: face, hands, gestures, hair, pose, selfie multiclass) MediaPipe face/hand/gesture/hair/pose/selfie-multiclass ~/.local/share/raea-models/mediapipe-* Apache-2.0 unverified
|
||||
raea/mediapipe cloud+windows+linux none - - - - unverified parity owed: Core ML only
|
||||
raea/edgetam mac ships Core ML (systems/vision object.rs) EdgeTAM image encoder + mask decoder ~/.local/share/raea-models/edgetam unread here unverified
|
||||
raea/edgetam cloud+windows+linux none - - - - unverified parity owed: Core ML only
|
||||
raea/depth-anything-3-small mac ships Core ML (systems/vision depth.rs) Depth Anything 3 Small (+ camera head) ~/.local/share/raea-models/depth-anything-3-small Apache-2.0 unverified
|
||||
raea/depth-anything-3-small cloud+windows+linux none - - - - unverified parity owed: Core ML only
|
||||
raea/soma cloud ships data (SOMA body model) SOMA_neutral.npz, template rig volume raea-models:/raea/soma see its LICENSE unverified
|
||||
raea/soma desktop ships data SOMA_neutral.npz, template rig ~/.local/share/raea-models/soma see its LICENSE unverified
|
||||
raea/garments cloud ships data garment-words.npz, soma_sdf.npz volume raea-models:/raea/garments ours unverified
|
||||
raea/garments desktop ships data garment-words.npz, soma_sdf.npz ~/.local/share/raea-models/garments ours unverified
|
||||
raea/overlay-seg cloud ships raea's own (overlay-seg.bpk) overlay-seg.bpk + cut.json volume raea-models:/raea/overlay-seg ours unverified
|
||||
raea/overlay-seg desktop ships raea's own overlay-seg.bpk + cut.json ~/.local/share/raea-models/overlay-seg ours unverified
|
||||
raea/siglip2-256 cloud+desktop found - siglip2-base-p16-256 ~/.local/share/raea-models/siglip2-base-p16-256 Apache-2.0 unverified on disk, use not traced
|
||||
raea/nomic-embed cloud+desktop found - nomic-embed-v1.5 text volume raea-models:/raea/nomic-embed-v1.5 (--all) unread here unverified use not traced
|
||||
raea/whisper-base cloud+desktop found - onnx-community/whisper-base volume raea-models:/library (--all) MIT unverified use not traced
|
||||
raea/critic cloud+desktop found - critic bank-v1.npz ~/.local/share/raea-models/critic ours unverified use not traced
|
||||
raea/qwen3-0.6b cloud+desktop found - Qwen/Qwen3-0.6B - Apache-2.0 unverified in code, use not traced
|
||||
raea/dinov2-small cloud+desktop found - onnx-community/dinov2-small - Apache-2.0 unverified in code, use not traced
|
||||
raea/depth-anything-v2-small cloud+desktop found - onnx-community/depth-anything-v2-small - Apache-2.0 unverified in code, use not traced
|
||||
raea/sam2.1-small cloud+desktop found - facebook/sam2.1-hiera-small - Apache-2.0 unverified in code, use not traced
|
||||
raea/whisper-hosted cloud+desktop ships hosted API, not delivered by us (apps/app/host/library/words.ts; farm.py: OpenRouter, Groq) openai/whisper-large-v3 the provider's MIT 2026-12-06 words for the app library and the farm
|
||||
|
Can't render this file because it contains an unexpected character in line 36 and column 225.
|
Reference in new issue
Block a user