Skip to content

Commit 9222ca9

Browse files
committed
ci : add --fail to curl download and propagate
This commit adds the --fail option to the model download scripts so that if the model download returns a server error this is picked up. This is then detected in run.sh and a error message is displayed and the script stops and returns an error. The motivation for this is that currently it is possible for the model download to fail but this script proceeds and instead of a model file the contents will be an html page probably with the error. This will then cause the model to not be able to load due to a missing magic number. I'm not sure we can do much about the downloading failing, perhaps a retry but at least this will give a clearer error message. Refs: https://github.com/danbev/whisper.cpp/actions/runs/26866349389/job/79230794512
1 parent 00674a7 commit 9222ca9

2 files changed

Lines changed: 6 additions & 1 deletion

File tree

ci/run.sh

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,12 @@ function gg_download_model {
152152
mkdir -p "$MNT/models"
153153
cd "$MNT/models"
154154
bash "$cwd/models/download-ggml-model.sh" ${model_name} .
155+
local download_status=$?
155156
cd "$cwd"
157+
if [ $download_status -ne 0 ]; then
158+
echo "Error: failed to download model ${model_name}"
159+
ret=1
160+
fi
156161
fi
157162
}
158163

models/download-ggml-model.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ fi
120120
if [ -x "$(command -v wget2)" ]; then
121121
wget2 --no-config --progress bar -O ggml-"$model".bin $src/$pfx-"$model".bin
122122
elif [ -x "$(command -v curl)" ]; then
123-
curl -L --output ggml-"$model".bin $src/$pfx-"$model".bin
123+
curl -L --fail --output ggml-"$model".bin $src/$pfx-"$model".bin
124124
elif [ -x "$(command -v wget)" ]; then
125125
wget --no-config --quiet --show-progress -O ggml-"$model".bin $src/$pfx-"$model".bin
126126
else

0 commit comments

Comments
 (0)