Skip to content

Open-source speech recognition toolkit for training, inference, streaming ASR, VAD, punctuation, speaker diarization pipelines, and OpenAI-compatible/MCP serving.

fix: B1 script portability (Hugging Face CLI fallback + friendly missing-dep error) (#3002)

zhifu gao49bc9b502da3
diff --git a/runtime/llama.cpp/convert-funasr-to-gguf.py b/runtime/llama.cpp/convert-funasr-to-gguf.py
index 77ca9013e..89296c3f6 100644
--- a/runtime/llama.cpp/convert-funasr-to-gguf.py
+++ b/runtime/llama.cpp/convert-funasr-to-gguf.py
@@ -42,11 +42,15 @@ def find_script(name):
def download(key, src):
hf_repo, ms_id, _, _, _ = MODELS[key]
- if src == "modelscope":
- from modelscope import snapshot_download
- return snapshot_download(ms_id)
- from huggingface_hub import snapshot_download
- return snapshot_download(hf_repo)
+ try:
+ if src == "modelscope":
+ from modelscope import snapshot_download
+ return snapshot_download(ms_id)
+ from huggingface_hub import snapshot_download
+ return snapshot_download(hf_repo)
+ except ModuleNotFoundError as e:
+ pkg = "modelscope" if src == "modelscope" else "huggingface_hub"
+ sys.exit(f"error: missing {e.name} - install it with: pip install -U {pkg}")
def pick(d, *names):
for n in names:
diff --git a/runtime/llama.cpp/download-funasr-model.sh b/runtime/llama.cpp/download-funasr-model.sh
index 87288bce3..fc676b82f 100755
--- a/runtime/llama.cpp/download-funasr-model.sh
+++ b/runtime/llama.cpp/download-funasr-model.sh
@@ -14,10 +14,13 @@ case "$MODEL" in
fsmn-vad|vad) REPO="FunAudioLLM/fsmn-vad-GGUF" ;;
*) usage ;;
esac
-command -v hf >/dev/null 2>&1 || { echo "install first: pip install -U huggingface_hub"; exit 1; }
+# huggingface_hub ships `hf` (new CLI); older versions only have `huggingface-cli` (deprecated). Use whichever exists.
+if command -v hf >/dev/null 2>&1; then HF=hf
+elif command -v huggingface-cli >/dev/null 2>&1; then HF=huggingface-cli
+else echo "need the Hugging Face CLI: pip install -U huggingface_hub"; exit 1; fi
mkdir -p "$OUT"
-echo "downloading $REPO ..."; hf download "$REPO" --include "*.gguf" --local-dir "$OUT"
+echo "downloading $REPO ..."; "$HF" download "$REPO" --include "*.gguf" --local-dir "$OUT"
if [ "$MODEL" != "fsmn-vad" ] && [ "$MODEL" != "vad" ]; then
- echo "downloading FSMN-VAD (for --vad) ..."; hf download FunAudioLLM/fsmn-vad-GGUF --include "*.gguf" --local-dir "$OUT"
+ echo "downloading FSMN-VAD (for --vad) ..."; "$HF" download FunAudioLLM/fsmn-vad-GGUF --include "*.gguf" --local-dir "$OUT"
fi
echo "done -> $OUT"; ls -1 "$OUT"/*.gguf