Build Rust extensions on demand in source checkouts (#34994)
This commit is contained in:
@@ -7,7 +7,7 @@ license.workspace = true
|
||||
|
||||
# Consumed by python/setup.py: registers this crate as a PyO3 extension module.
|
||||
[package.metadata.sglang]
|
||||
python-module = "sglang.srt.server._core"
|
||||
python-module = "sglang.srt.rust_extensions._server"
|
||||
# Always build optimized, even for an editable install.
|
||||
debug = false
|
||||
|
||||
|
||||
@@ -13,4 +13,4 @@ classifiers = [
|
||||
dynamic = ["version"]
|
||||
|
||||
[tool.maturin]
|
||||
module-name = "_core"
|
||||
module-name = "_server"
|
||||
|
||||
@@ -836,6 +836,7 @@ pub(super) fn chat_logprobs(extras: Option<&ChunkExtras>) -> ChatChoiceLogprobs
|
||||
bytes: Some(token.as_bytes().to_vec()),
|
||||
token,
|
||||
logprob,
|
||||
token_id: u32::try_from(token_id).ok(),
|
||||
top_logprobs,
|
||||
});
|
||||
}
|
||||
@@ -1020,6 +1021,7 @@ mod tests {
|
||||
let logprobs = chat_logprobs(Some(&extras));
|
||||
let token = &logprobs.content.unwrap()[0];
|
||||
assert_eq!(token.token, "x");
|
||||
assert_eq!(token.token_id, Some(7));
|
||||
assert_eq!(token.top_logprobs.len(), 2);
|
||||
assert_eq!(token.top_logprobs[1].token, "y");
|
||||
}
|
||||
|
||||
@@ -292,7 +292,7 @@ static LOG_GUARD: std::sync::OnceLock<tracing_appender::non_blocking::WorkerGuar
|
||||
std::sync::OnceLock::new();
|
||||
|
||||
#[pymodule]
|
||||
fn _core(m: &Bound<'_, PyModule>) -> PyResult<()> {
|
||||
fn _server(m: &Bound<'_, PyModule>) -> PyResult<()> {
|
||||
// Initialize tracing once; ignore if already set by the host process.
|
||||
// Non-blocking writer: emitting threads (axum workers, egress, detok) only
|
||||
// enqueue; a dedicated thread does the stdout formatting-flush + syscall.
|
||||
|
||||
Reference in New Issue
Block a user