Ad_gen / setup.sh
Flulike99's picture
debug
1685bfc
#!/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."