download_missing_models.sh: always sync workflows/ from the repo before planning (add --no-refresh to opt out) — stale baked-in workflows made the plan miss newly added models
Browse files- download_missing_models.sh +18 -0
download_missing_models.sh
CHANGED
|
@@ -16,6 +16,7 @@
|
|
| 16 |
# ./download_missing_models.sh --dry-run ... # show the plan, install/download nothing
|
| 17 |
# ./download_missing_models.sh --skip-nodes .. # models only, skip custom-node installs
|
| 18 |
# ./download_missing_models.sh --yes ... # skip the "Proceed?" confirmation
|
|
|
|
| 19 |
#
|
| 20 |
# Auth: uses the HUGGING_FACE_ACCESS_TOKEN environment variable if set
|
| 21 |
# (falls back to HF_TOKEN), otherwise prompts for a token.
|
|
@@ -467,6 +468,23 @@ def main():
|
|
| 467 |
local_dir=WORKSPACE,
|
| 468 |
token=os.environ.get("HF_TOKEN"),
|
| 469 |
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 470 |
|
| 471 |
files = sorted(glob.glob(os.path.join(WORKFLOWS_DIR, "*.json")))
|
| 472 |
if not files:
|
|
|
|
| 16 |
# ./download_missing_models.sh --dry-run ... # show the plan, install/download nothing
|
| 17 |
# ./download_missing_models.sh --skip-nodes .. # models only, skip custom-node installs
|
| 18 |
# ./download_missing_models.sh --yes ... # skip the "Proceed?" confirmation
|
| 19 |
+
# ./download_missing_models.sh --no-refresh .. # don't re-sync ./workflows from the HF repo first
|
| 20 |
#
|
| 21 |
# Auth: uses the HUGGING_FACE_ACCESS_TOKEN environment variable if set
|
| 22 |
# (falls back to HF_TOKEN), otherwise prompts for a token.
|
|
|
|
| 468 |
local_dir=WORKSPACE,
|
| 469 |
token=os.environ.get("HF_TOKEN"),
|
| 470 |
)
|
| 471 |
+
elif "--no-refresh" not in argv:
|
| 472 |
+
# The workflows baked into the pod image can lag the HF repo, and a
|
| 473 |
+
# stale copy makes the model plan silently miss anything added to a
|
| 474 |
+
# workflow since the image was built. Sync workflows/*.json from the
|
| 475 |
+
# repo before planning; the repo wins over local edits, so pass
|
| 476 |
+
# --no-refresh to plan against the local copies instead.
|
| 477 |
+
print(f"{C_CYAN}Syncing workflows from hf.co/{REPO_ID} (--no-refresh to skip) ...{C_RESET}")
|
| 478 |
+
try:
|
| 479 |
+
from huggingface_hub import snapshot_download
|
| 480 |
+
snapshot_download(
|
| 481 |
+
repo_id=REPO_ID,
|
| 482 |
+
allow_patterns=["workflows/*.json"],
|
| 483 |
+
local_dir=WORKSPACE,
|
| 484 |
+
token=os.environ.get("HF_TOKEN"),
|
| 485 |
+
)
|
| 486 |
+
except Exception as e:
|
| 487 |
+
print(f"{C_YELLOW}⚠ workflow sync failed ({e}) — planning against the local copies.{C_RESET}")
|
| 488 |
|
| 489 |
files = sorted(glob.glob(os.path.join(WORKFLOWS_DIR, "*.json")))
|
| 490 |
if not files:
|