[Rust Frontend][gRPC] Add LoRA lifecycle control (#52840)

Co-authored-by: Bugen Zhao <i@bugenzhao.com>
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
Signed-off-by: Connor Carpenter <connorc@nvidia.com>
Signed-off-by: Bugen Zhao <i@bugenzhao.com>
This commit is contained in:
Connor Carpenter
2026-08-25 04:13:19 +00:00
committed by GitHub
co-authored by Bugen Zhao mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
parent af119619c4
commit 1f9444a34f
12 changed files with 470 additions and 81 deletions
@@ -2,6 +2,7 @@
// SPDX-FileCopyrightText: Copyright contributors to the vLLM project
use serde_tuple::{Deserialize_tuple, Serialize_tuple};
use thiserror::Error;
use crate::protocol::OpaqueValue;
@@ -24,6 +25,16 @@ pub struct LoraRequest {
pub is_3d_lora_weight: bool,
}
#[derive(Debug, Error, PartialEq, Eq)]
pub enum LoraRequestError {
#[error("lora_name must not be empty")]
EmptyName,
#[error("lora_int_id must be nonzero")]
ZeroId,
#[error("lora_path must not be empty")]
EmptyPath,
}
impl LoraRequest {
pub fn new(
lora_name: String,
@@ -31,8 +42,18 @@ impl LoraRequest {
lora_path: String,
load_inplace: bool,
is_3d_lora_weight: bool,
) -> Self {
Self {
) -> Result<Self, LoraRequestError> {
if lora_name.trim().is_empty() {
return Err(LoraRequestError::EmptyName);
}
if lora_int_id == 0 {
return Err(LoraRequestError::ZeroId);
}
if lora_path.trim().is_empty() {
return Err(LoraRequestError::EmptyPath);
}
Ok(Self {
lora_name,
lora_int_id,
lora_path,
@@ -40,6 +61,6 @@ impl LoraRequest {
tensorizer_config_dict: None,
load_inplace,
is_3d_lora_weight,
}
})
}
}