[GW] Real GPU --serve: wire the verified forward + sampler + Lean-proven session
Resident GEN/STOP/QUIT service (strata-ctl contract) composing the three verified pieces:
- ld::layer::forward_inkling_with_state (48-visit autoregressive forward, persistent KV/ShortConv);
- abi::sampler (hardened zero-alloc greedy/top-k/p/min-p + penalties, non-finite tracking);
- gw::session::ServeSession (proofs/serve_session.lean FSM: GEN 0 pre-warm, STOP->DONE drain).
serve_gen is a pure orchestration fn (engine + ParsedGen + stop flag + emit closure), GPU-integration-tested. run_serve adds a stdin reader thread raising stop/quit atomics so STOP interrupts decode and drains to DONE. Token-id based (no tokenizer needed). gw 'hip' feature default OFF keeps the gateway host-independent.
Measured: live binary over pipe -> READY 8192 stop; 'The capital of France is' -> T 152717 (' Paris', exact ref) T 13 T 198 T 3967; DONE length. STOP after 2 tokens -> DONE 2 ... stop, no further tokens (Theorem 4/9). QUIT exits clean.
Verified: cargo test --workspace green (-D warnings), gw hip 10 default + 2 GPU serve tests green, 5 Lean files 0 sorryAx.
This commit is contained in:
1 parent
08514e81b1
commit
26bff57645
5 files changed
+421
-1
No files matched your search
@@ -10,6 +10,7 @@ fn usage() {
|
||||
eprintln!("Usage:");
|
||||
eprintln!(" vetta-infer info <safetensors-dir> Inspect shards, dtypes, and checked bounds");
|
||||
eprintln!(" vetta-infer tensors <dir> [prefix] List tensors (name, dtype, shape, bytes)");
|
||||
eprintln!(" vetta-infer serve <safetensors-dir> Resident GEN/STOP/QUIT wire service (GPU, --features hip)");
|
||||
eprintln!(" vetta-infer version Print version & build info");
|
||||
}
|
||||
|
||||
@@ -92,6 +93,29 @@ fn main() -> ExitCode {
|
||||
}
|
||||
}
|
||||
}
|
||||
Some("serve") => {
|
||||
let Some(dir) = args.get(1) else {
|
||||
eprintln!("error: missing <safetensors-dir>");
|
||||
usage();
|
||||
return ExitCode::from(2);
|
||||
};
|
||||
#[cfg(feature = "hip")]
|
||||
{
|
||||
match vetta_infer_gw::serve::run_serve(dir) {
|
||||
Ok(()) => ExitCode::SUCCESS,
|
||||
Err(e) => {
|
||||
eprintln!("error: {e}");
|
||||
ExitCode::FAILURE
|
||||
}
|
||||
}
|
||||
}
|
||||
#[cfg(not(feature = "hip"))]
|
||||
{
|
||||
let _ = dir;
|
||||
eprintln!("error: 'serve' requires the GPU backend; rebuild with --features hip");
|
||||
ExitCode::from(2)
|
||||
}
|
||||
}
|
||||
_ => {
|
||||
usage();
|
||||
ExitCode::from(2)
|
||||
|
||||
Reference in new issue
Block a user