Spaces:
Paused
Paused
File size: 1,068 Bytes
4631758 f9553e7 4631758 f9553e7 4631758 f9553e7 1685bfc 4631758 f9553e7 4631758 f9553e7 4631758 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 |
#!/bin/bash
set -euo pipefail
echo "Preloading Hugging Face assets..."
python - <<'PY'
import os
from huggingface_hub import snapshot_download, hf_hub_download
token = os.environ.get("CASCADE_PRIVATE_MODEL_HF_TOKEN")
secret_model = os.environ.get("MODEL_PATH")
base_model = os.environ.get("BASE_MODEL_ID")
if not token:
raise SystemExit("CASCADE_PRIVATE_MODEL_HF_TOKEN is not set")
if not secret_model:
raise SystemExit("MODEL_PATH is not set")
if not base_model:
raise SystemExit("BASE_MODEL_ID is not set")
# 下载私有 LoRA 权重
print("Fetching Cascade private LoRA weights...")
hf_hub_download(
repo_id="Cascade-Inc/private_model",
filename=secret_model,
token=token,
repo_type="space",
)
# 如果设置了 BASE_MODEL_ID,下载 pipeline loader
if base_model:
print(f"Fetching pipeline loader: {base_model}...")
hf_hub_download(
repo_id="Cascade-Inc/private_model",
filename=base_model,
token=token,
repo_type="space",
)
print("All assets downloaded.")
PY
echo "Setup complete."
|