Skip to content

Commit 297944a

Browse files
committed
Capture model_files and check if empty
1 parent 855dc50 commit 297944a

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

backends/src/lib.rs

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -338,11 +338,16 @@ async fn init_backend(
338338
{
339339
if let Some(api_repo) = api_repo.as_ref() {
340340
let start = std::time::Instant::now();
341-
match download_onnx(api_repo).await {
342-
Ok(_) => {
341+
let model_files = download_onnx(api_repo)
342+
.await
343+
.map_err(|err| BackendError::WeightsNotFound(err.to_string()))?;
344+
match model_files.is_empty() {
345+
true => {
346+
tracing::error!("Model ONNX files not found in the repository")
347+
}
348+
false => {
343349
tracing::info!("Model ONNX weights downloaded in {:?}", start.elapsed())
344350
}
345-
Err(err) => BackendError::WeightsNotFound(err.to_string()),
346351
}
347352
}
348353

0 commit comments

Comments
 (0)