@@ -1214,15 +1214,24 @@ async def model_download(request: Request, req: ModelDownloadRequest):
12141214 runner_lines .append ('fi' )
12151215 runner_lines .append ('if [ -z "$ODYSSEUS_OLLAMA_PULL_CMD" ]; then echo "ERROR: Ollama not found on this server. Install Ollama or start an ollama-rocm/ollama-test container."; exit 127; fi' )
12161216 else :
1217- runner_lines .append (f"command -v hf >/dev/null 2>&1 || command -v huggingface-cli >/dev/null 2>&1 || { _pip_install_fallback_chain ('huggingface_hub' , python_cmd = '\" $ODYSSEUS_PY\" -m pip' , upgrade = True )} " )
1217+ hf_hub_install = _pip_install_fallback_chain (
1218+ "huggingface_hub" ,
1219+ python_cmd = '"$ODYSSEUS_PY" -m pip' ,
1220+ upgrade = True ,
1221+ )
1222+ runner_lines .append (f"command -v hf >/dev/null 2>&1 || command -v huggingface-cli >/dev/null 2>&1 || { hf_hub_install } " )
12181223 runner_lines .append ('hash -r 2>/dev/null || true' )
12191224 runner_lines .append ('ODYSSEUS_HF_CLI="$(command -v hf || command -v huggingface-cli || true)"' )
12201225 runner_lines .append ('if [ -z "$ODYSSEUS_HF_CLI" ]; then echo "ERROR: HF CLI not found after installing huggingface_hub."; exit 127; fi' )
12211226 if req .disable_hf_transfer :
12221227 runner_lines .append ("export HF_HUB_ENABLE_HF_TRANSFER=0" )
12231228 runner_lines .append ("export HF_HUB_DOWNLOAD_MAX_WORKERS=4" )
12241229 else :
1225- runner_lines .append (f"\" $ODYSSEUS_PY\" -c 'import hf_transfer' 2>/dev/null || { _pip_install_fallback_chain ('hf_transfer' , python_cmd = '\" $ODYSSEUS_PY\" -m pip' )} " )
1230+ hf_transfer_install = _pip_install_fallback_chain (
1231+ "hf_transfer" ,
1232+ python_cmd = '"$ODYSSEUS_PY" -m pip' ,
1233+ )
1234+ runner_lines .append (f"\" $ODYSSEUS_PY\" -c 'import hf_transfer' 2>/dev/null || { hf_transfer_install } " )
12261235 runner_lines .append ("\" $ODYSSEUS_PY\" -c 'import hf_transfer' 2>/dev/null && export HF_HUB_ENABLE_HF_TRANSFER=1" )
12271236 runner_lines .append ("export HF_HUB_DOWNLOAD_MAX_WORKERS=8" )
12281237 # Surface whether the HF token actually reached THIS server, so a gated
0 commit comments