File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 5757# huggingface_hub ships `hf` (new CLI); older versions only have `huggingface-cli` (deprecated). Use whichever exists.
5858if command -v hf > /dev/null 2>&1 ; then HF=hf
5959elif command -v huggingface-cli > /dev/null 2>&1 ; then HF=huggingface-cli
60- else echo " need the Hugging Face CLI: pip install -U huggingface_hub" ; exit 1; fi
60+ else echo " error: need the Hugging Face CLI: pip install -U huggingface_hub" >&2 ; exit 1; fi
6161mkdir -p " $OUT "
6262echo " downloading $REPO ..."
6363if [ ${# FILES[@]} -eq 0 ]; then
@@ -69,4 +69,12 @@ if [ "$MODEL" != "fsmn-vad" ] && [ "$MODEL" != "vad" ]; then
6969 echo " downloading FSMN-VAD (for --vad) ..."
7070 " $HF " download FunAudioLLM/fsmn-vad-GGUF fsmn-vad.gguf --local-dir " $OUT "
7171fi
72- echo " done -> $OUT " ; ls -1 " $OUT " /* .gguf
72+ shopt -s nullglob
73+ GGUF_FILES=(" $OUT " /* .gguf)
74+ shopt -u nullglob
75+ if [ ${# GGUF_FILES[@]} -eq 0 ]; then
76+ echo " error: no GGUF files found in $OUT " >&2
77+ exit 1
78+ fi
79+ echo " done -> $OUT "
80+ printf ' %s\n' " ${GGUF_FILES[@]} "
Original file line number Diff line number Diff line change @@ -13,6 +13,10 @@ set -euo pipefail
1313
1414printf '%s\n' "$*" >>"$HF_LOG"
1515
16+ if [[ "${HF_SKIP_CREATE:-0}" == 1 ]]; then
17+ exit 0
18+ fi
19+
1620out=
1721args=("$@")
1822for ((i = 0; i < ${#args[@]}; i++)); do
@@ -87,4 +91,19 @@ if bash "$SCRIPT" sensevoice "$TMP/out" q4km >/dev/null 2>&1; then
8791fi
8892[[ ! -s " $HF_LOG " ]]
8993
94+ mkdir -p " $TMP /empty-bin"
95+ if PATH=" $TMP /empty-bin" /bin/bash " $SCRIPT " sensevoice " $TMP /out" > " $TMP /stdout" 2> " $TMP /stderr" ; then
96+ echo " download succeeded without a Hugging Face CLI" >&2
97+ exit 1
98+ fi
99+ [[ ! -s " $TMP /stdout" ]]
100+ grep -F " need the Hugging Face CLI" " $TMP /stderr" > /dev/null
101+
102+ reset_case
103+ if HF_SKIP_CREATE=1 bash " $SCRIPT " sensevoice " $TMP /out" > " $TMP /stdout" 2> " $TMP /stderr" ; then
104+ echo " download succeeded without producing a GGUF file" >&2
105+ exit 1
106+ fi
107+ grep -F " no GGUF files found in $TMP /out" " $TMP /stderr" > /dev/null
108+
90109echo " download-funasr-model contract tests passed"
You can’t perform that action at this time.
0 commit comments