config: the readback and the resolving view say what they are (#35027)

This commit is contained in:
Cheng Wan
2026-08-17 16:18:19 -07:00
committed by GitHub
parent cba3c5d5ac
commit c70c7d72a8
12 changed files with 775 additions and 97 deletions
+16 -1
View File
@@ -70,10 +70,18 @@ async fn await_control_result(
/// `GET /get_model_info` (+ `/model_info` alias) — static model metadata from
/// `server_args` (no scheduler round-trip); `is_generation` always true.
///
/// Under `SGLANG_RUST_SERVER=1` this is the only `/model_info` a client can
/// reach — `launch_server` never mounts the Python app — so it answers the same
/// keys. It answers them from the launch blob, which is the whole of this
/// server's config knowledge: `server_args` is parsed once at boot and held
/// behind an `Arc`, and no route mounted here changes weights or parsers, so
/// the launch values are also the current ones.
async fn model_info(State(state): State<AppState>) -> Response {
let sa = &state.server_args;
let body = serde_json::json!({
"model_path": sa.model_path,
"served_model_name": sa.served_model_name,
"tokenizer_path": sa.tokenizer_path,
"is_generation": true,
// Python's `TokenizerManager` merges this into every request
@@ -81,7 +89,14 @@ async fn model_info(State(state): State<AppState>) -> Response {
// `RustServer.launch` REFUSES to start when it is set. It can therefore
// only be null here — echoing it keeps the field's shape.
"preferred_sampling_params": sa.preferred_sampling_params,
"weight_version": serde_json::Value::Null,
// Python answers this through `config_value`, so a control-plane write
// moves it there; here it is the launch value.
"weight_version": sa.weight_version,
"load_format": sa.load_format,
// `auto` never reaches the blob: `resolve_auto_parsers` writes the
// selected parser into `server_args` before the scheduler forks.
"reasoning_parser": sa.reasoning_parser,
"tool_call_parser": sa.tool_call_parser,
});
(
StatusCode::OK,
+12
View File
@@ -72,6 +72,18 @@ pub struct ServerArgs {
/// HF revision, used only when `tokenizer_path` is a repo id. `None` → main.
#[serde(default)]
pub revision: Option<String>,
/// Weight format selected by `--load-format`, reported by `/get_model_info`.
/// The blob carries the post-`__post_init__` value (`auto` is already
/// narrowed to `gguf` / `mistral` / `runai_streamer` / `remote` where the
/// checkpoint demands it). Not consumed for loading -- the scheduler owns
/// that; `None` only when the blob omits the key.
#[serde(default)]
pub load_format: Option<String>,
/// Operator-supplied weight version, reported by `/model_info`. Defaults to
/// `"default"` on the Python side, so it is present in every blob; `None`
/// only when the blob omits the key.
#[serde(default)]
pub weight_version: Option<String>,
/// HTTP bind address (see [`Self::bind`]).
#[serde(default = "default_host")]
pub host: String,