fix(launcher): handle hub branches (#278)

This commit is contained in:
Nicolas Patry 2023-05-04 15:14:28 +02:00 committed by GitHub
parent b67908e0cf
commit b4fe248b17
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 3 deletions

View File

@ -258,9 +258,10 @@ fn init_logging(otlp_endpoint: Option<String>, json_output: bool) {
/// get model info from the Huggingface Hub
pub async fn get_model_info(model_id: &str, revision: &str, token: Option<String>) -> HubModelInfo {
let client = reqwest::Client::new();
let mut builder = client.get(format!(
"https://huggingface.co/api/models/{model_id}/revision/{revision}"
));
// Poor man's urlencode
let revision = revision.replace("/", "%2F");
let url = format!("https://huggingface.co/api/models/{model_id}/revision/{revision}");
let mut builder = client.get(url);
if let Some(token) = token {
builder = builder.bearer_auth(token);
}