Unverified Commit f7ba417e authored by ゆり's avatar ゆり Committed by GitHub
Browse files

fix: preserve original model path for frontend config downloads (#5102)


Signed-off-by: default avataryurekami <yurekami@users.noreply.github.com>
Co-authored-by: default avataryurekami <yurekami@users.noreply.github.com>
parent 1c9fea01
...@@ -175,6 +175,13 @@ pub struct ModelDeploymentCard { ...@@ -175,6 +175,13 @@ pub struct ModelDeploymentCard {
// Cache the Slugified display_name so we can share references to it // Cache the Slugified display_name so we can share references to it
slug: Slug, slug: Slug,
/// Original HuggingFace repository path for downloading model files.
/// When `display_name` is customized (e.g., via `--served-model-name`),
/// this field preserves the original repository path needed for downloads.
/// Falls back to `display_name` if not set.
#[serde(default, skip_serializing_if = "Option::is_none")]
pub source_model: Option<String>,
/// Model information /// Model information
pub model_info: Option<ModelInfoType>, pub model_info: Option<ModelInfoType>,
...@@ -367,6 +374,10 @@ impl ModelDeploymentCard { ...@@ -367,6 +374,10 @@ impl ModelDeploymentCard {
/// Allow user to override the name we register this model under. /// Allow user to override the name we register this model under.
/// Corresponds to vllm's `--served-model-name`. /// Corresponds to vllm's `--served-model-name`.
pub fn set_name(&mut self, name: &str) { pub fn set_name(&mut self, name: &str) {
// Preserve original model path before overwriting display_name
if self.source_model.is_none() && !self.display_name.is_empty() {
self.source_model = Some(self.display_name.clone());
}
self.display_name = name.to_string(); self.display_name = name.to_string();
self.slug = Slug::from_string(name); self.slug = Slug::from_string(name);
} }
...@@ -402,7 +413,8 @@ impl ModelDeploymentCard { ...@@ -402,7 +413,8 @@ impl ModelDeploymentCard {
} }
let ignore_weights = true; let ignore_weights = true;
let local_path = crate::hub::from_hf(&self.display_name, ignore_weights).await?; let model_name = self.source_model.as_ref().unwrap_or(&self.display_name);
let local_path = crate::hub::from_hf(model_name, ignore_weights).await?;
self.update_dir(&local_path); self.update_dir(&local_path);
Ok(()) Ok(())
...@@ -547,6 +559,7 @@ impl ModelDeploymentCard { ...@@ -547,6 +559,7 @@ impl ModelDeploymentCard {
Ok(Self { Ok(Self {
slug: Slug::from_string(&display_name), slug: Slug::from_string(&display_name),
display_name, display_name,
source_model: None,
model_info, model_info,
tokenizer, tokenizer,
gen_config, gen_config,
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment