[Proto] clamp generation budget to window instead of hard-error (reviewer)
strata-ctl always sends max_new=16384, so any prompt > MAX_CONTEXT-16386 (16504 / 16686 seen live in sessions.db) hit the hard error and returned 0 tokens, killing the agent mid-window. Now clamp_max_new(): hard-error only when the prompt itself overflows (n_prompt+2 >= max_context); otherwise effective_max_new = min(g.max_new, max_context-n_prompt-2) drives max_seq, history reserve, the decode loop and the length finish. Resident window configurable like strata: VETTA_MAX_CONTEXT env / serve --max-context N (>=4096), advertised in READY. CPU test clamp_max_new_budget (16504/16686 clamp, 32765->1, 32766->None, 65536 full). MEASURED live: 16504-token prompt GEN2 now runs (2 tokens, DONE 107.6s ~6.5ms/tok) where it previously returned ERR 0 tokens; READY 32768 default / 65536 with flag. gw serve_gen 4/4 EXACT; CPU -D warnings green.
This commit is contained in:
1 parent
cfa5586447
commit
ee8ac8f5df
2 files changed
+64
-11
No files matched your search
@@ -11,7 +11,7 @@ fn 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!(" (alias: --serve <dir>, as strata-ctl spawns it)");
|
||||
eprintln!(" (alias: --serve <dir>, as strata-ctl spawns it; [--max-context N])");
|
||||
eprintln!(" vetta-infer chat <dir> [effort] [max_new] Interactive multi-turn chat (GPU, --features hip)");
|
||||
eprintln!(" vetta-infer version Print version & build info");
|
||||
}
|
||||
@@ -101,6 +101,13 @@ fn main() -> ExitCode {
|
||||
usage();
|
||||
return ExitCode::from(2);
|
||||
};
|
||||
// Optional resident window override (like strata --max-context):
|
||||
// `serve <dir> --max-context N`. Defaults to 32768 when absent.
|
||||
if let Some(i) = args.iter().position(|a| a == "--max-context") {
|
||||
if let Some(v) = args.get(i + 1).and_then(|s| s.parse::<usize>().ok()) {
|
||||
unsafe { std::env::set_var("VETTA_MAX_CONTEXT", v.to_string()) };
|
||||
}
|
||||
}
|
||||
#[cfg(feature = "hip")]
|
||||
{
|
||||
match vetta_infer_gw::serve::run_serve(dir) {
|
||||
|
||||
Reference in new issue
Block a user