Skip to content
This repository was archived by the owner on Jul 4, 2025. It is now read-only.

Commit 3e0f6ea

Browse files
committed
fix: handle hf download by model id
1 parent 79b1486 commit 3e0f6ea

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

engine/controllers/models.cc

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,20 @@ void Models::PullModel(const HttpRequestPtr& req,
5858
model_handle, desired_model_id, desired_model_name);
5959
} else if (model_handle.find(":") != std::string::npos) {
6060
auto model_and_branch = string_utils::SplitBy(model_handle, ":");
61+
if (model_and_branch.size() == 3) {
62+
auto mh = url_parser::Url{
63+
.protocol = "https",
64+
.host = kHuggingFaceHost,
65+
.pathParams = {
66+
model_and_branch[0],
67+
model_and_branch[1],
68+
"resolve",
69+
"main",
70+
model_and_branch[2],
71+
}}.ToFullPath();
72+
return model_service_->HandleDownloadUrlAsync(mh, desired_model_id,
73+
desired_model_name);
74+
}
6175
return model_service_->DownloadModelFromCortexsoAsync(
6276
model_and_branch[0], model_and_branch[1], desired_model_id);
6377
}

0 commit comments

Comments
 (0)