Skip to content

Commit

Permalink
improve model downloading
Browse files Browse the repository at this point in the history
  • Loading branch information
thewh1teagle committed Dec 18, 2024
1 parent 18e1ab5 commit 371af90
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
2 changes: 1 addition & 1 deletion core/src/downloader.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ impl Downloader {
F: Fn(u64, u64) -> bool,
{
tracing::debug!("download from {} to {}", url, path.display());
let res = self.client.get(url).send().await?;
let res = self.client.get(url).send().await?.error_for_status()?;
let total_size = res
.content_length()
.ok_or_eyre(format!("Failed to get content length from '{}'", url))?;
Expand Down
7 changes: 6 additions & 1 deletion desktop/src-tauri/src/cmd/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,7 @@ pub async fn download_model(app_handle: tauri::AppHandle, url: Option<String>) -
} else {
let mut errors = Vec::new();
for url in DEFAULT_MODEL_URLS {
tracing::debug!("Download default model from URL {}", url);
match downloader
.download(url, model_path.to_owned(), download_progress_callback.clone())
.await
Expand All @@ -152,7 +153,11 @@ pub async fn download_model(app_handle: tauri::AppHandle, url: Option<String>) -
}
}
}
bail!("Could not download any model file. Errors: {:?}", errors);
bail!(
"Could not download any model file. Errors: {:?}\nTried from {:?}",
errors,
DEFAULT_MODEL_URLS.join(",")
);
}
}

Expand Down
2 changes: 1 addition & 1 deletion desktop/src-tauri/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ pub const DEFAULT_LOG_DIRECTIVE: &str = "vibe=DEBUG,vibe_core=DEBUG,whisper_rs=I
pub const STORE_FILENAME: &str = "app_config.json";
pub const DEFAULT_MODEL_URLS: &[&str] = &[
"https://huggingface.co/ggerganov/whisper.cpp/resolve/main/ggml-medium-q8_0.bin",
"https://github.com/thewh1teagle/vibe/releases/download/v0.0.1/ggml-medium.bin",
"https://github.com/thewh1teagle/vibe/releases/download/v0.0.1/ggml-medium-q8_0.bin",
];
pub const DEAFULT_MODEL_FILENAME: &str = "ggml-medium-q8_0.bin";

Expand Down

0 comments on commit 371af90

Please sign in to comment.