9740bc64c9
Firmware QEMU Tests (ADR-061) / QEMU Test (edge-tier1) (push) Has been skipped
Firmware QEMU Tests (ADR-061) / QEMU Test (full-adr060) (push) Has been skipped
Firmware QEMU Tests (ADR-061) / QEMU Test (tdm-3node) (push) Has been skipped
Firmware QEMU Tests (ADR-061) / Swarm Test (ADR-062) (push) Has been skipped
npm packages / tools/ruview-mcp (node 22) (push) Failing after 1s
nvsim-server → ghcr.io / build-and-publish (push) Failing after 1s
ruview-swarm CI guard / tests (full+train) (push) Failing after 2s
Bench Regression Guard / bench compile-verify (--no-run) (push) Failing after 0s
Bench Regression Guard / bench fast-run (informational, non-gating) (push) Has been skipped
Firmware CI / Verify version.txt matches release tag (push) Has been skipped
Dashboard a11y + cross-browser / a11y (push) Failing after 0s
nvsim Dashboard → GitHub Pages / build-and-deploy (push) Failing after 2s
Firmware CI / Build firmware (esp32s3 / 4mb) (push) Failing after 15s
Firmware QEMU Tests (ADR-061) / Build Espressif QEMU (push) Failing after 1s
Firmware QEMU Tests (ADR-061) / Fuzz Testing (ADR-061 Layer 6) (push) Failing after 1s
Continuous Deployment / Pre-deployment Checks (push) Has been skipped
Firmware CI / Build firmware (esp32c6 / c6-4mb) (push) Failing after 15s
Firmware CI / Build firmware (esp32s3 / 8mb) (push) Failing after 15s
Firmware QEMU Tests (ADR-061) / QEMU Test (boundary-max) (push) Has been skipped
Firmware QEMU Tests (ADR-061) / QEMU Test (boundary-min) (push) Has been skipped
Firmware QEMU Tests (ADR-061) / QEMU Test (default) (push) Has been skipped
Firmware QEMU Tests (ADR-061) / QEMU Test (edge-tier0) (push) Has been skipped
Firmware QEMU Tests (ADR-061) / NVS Matrix Generation (push) Failing after 1s
Security Scanning / Security Policy Compliance (push) Failing after 0s
Security Scanning / Dependency Vulnerability Scan (push) Failing after 0s
Security Scanning / Static Application Security Testing (push) Failing after 1s
Security Scanning / Infrastructure Security Scan (push) Failing after 1s
Security Scanning / Secret Scanning (push) Failing after 1s
npm packages / harness/ruview (node 22) (push) Failing after 17s
Security Scanning / License Compliance Scan (push) Failing after 1s
Security Scanning / Container Security Scan (push) Failing after 4s
three.js demos → GitHub Pages / build-and-deploy (push) Failing after 1s
Verify Pipeline Determinism / Verify Pipeline Determinism (3.11) (push) Failing after 1s
Fix-Marker Regression Guard / Verify fix markers (push) Failing after 1s
ADR-115 MQTT integration tests / mqtt-integration (push) Failing after 1s
npm packages / harness/ruview (node 20) (push) Failing after 1s
npm packages / tools/ruview-mcp (node 20) (push) Failing after 1s
npm packages / tools/ruview-cli (node 20) (push) Failing after 1s
npm packages / tools/ruview-cli (node 22) (push) Failing after 1s
BFLD MQTT Integration / cargo test --features mqtt (live mosquitto) (push) Failing after 29s
ruview-swarm CI guard / build train_marl bin (push) Failing after 2s
ruview-swarm CI guard / clippy (-D warnings, --no-deps) (push) Failing after 3s
ruview-swarm CI guard / tests (ruflo) (push) Failing after 1s
ruview-swarm CI guard / tests (train) (push) Failing after 2s
ruview-swarm CI guard / tests (default) (push) Failing after 2s
Point Cloud Viewer → GitHub Pages / build-and-deploy (push) Failing after 8s
ruview-swarm CI guard / ITAR / publish guard (push) Failing after 0s
wifi-densepose sensing-server → Docker Hub + ghcr.io / build · push · smoke-test (push) Failing after 1s
Continuous Deployment / Deploy to Production (push) Has been cancelled
Continuous Deployment / Rollback Deployment (push) Has been cancelled
Continuous Deployment / Post-deployment Monitoring (push) Has been cancelled
Continuous Deployment / Notify Deployment Status (push) Has been cancelled
Continuous Deployment / Deploy to Staging (push) Has been cancelled
Security Scanning / Security Report (push) Has been cancelled
191 lines
5.4 KiB
Bash
191 lines
5.4 KiB
Bash
#!/bin/bash
|
|
# Publish WiFi-DensePose pre-trained models to HuggingFace Hub
|
|
#
|
|
# Retrieves the HuggingFace API token from Google Cloud Secrets,
|
|
# then uploads model files from dist/models/ to a HuggingFace repo.
|
|
#
|
|
# Prerequisites:
|
|
# - gcloud CLI authenticated with access to cognitum-20260110
|
|
# - Python 3.8+ with pip
|
|
# - Model files present in dist/models/
|
|
#
|
|
# Usage:
|
|
# bash scripts/publish-huggingface.sh
|
|
# bash scripts/publish-huggingface.sh --repo ruvnet/wifi-densepose-pretrained --version v0.5.4
|
|
# bash scripts/publish-huggingface.sh --dry-run
|
|
|
|
set -euo pipefail
|
|
|
|
# ---------- defaults ----------
|
|
REPO="ruvnet/wifi-densepose-pretrained"
|
|
VERSION=""
|
|
GCLOUD_PROJECT="cognitum-20260110"
|
|
SECRET_NAME="HUGGINGFACE_API_KEY"
|
|
MODEL_DIR="dist/models"
|
|
DRY_RUN=false
|
|
|
|
# ---------- parse args ----------
|
|
while [[ $# -gt 0 ]]; do
|
|
case "$1" in
|
|
--repo) REPO="$2"; shift 2 ;;
|
|
--version) VERSION="$2"; shift 2 ;;
|
|
--model-dir) MODEL_DIR="$2"; shift 2 ;;
|
|
--project) GCLOUD_PROJECT="$2"; shift 2 ;;
|
|
--secret) SECRET_NAME="$2"; shift 2 ;;
|
|
--dry-run) DRY_RUN=true; shift ;;
|
|
-h|--help)
|
|
echo "Usage: bash scripts/publish-huggingface.sh [OPTIONS]"
|
|
echo ""
|
|
echo "Options:"
|
|
echo " --repo REPO HuggingFace repo (default: ruvnet/wifi-densepose-pretrained)"
|
|
echo " --version VERSION Version tag (default: auto from git describe)"
|
|
echo " --model-dir DIR Model directory (default: dist/models)"
|
|
echo " --project PROJECT GCloud project (default: cognitum-20260110)"
|
|
echo " --secret SECRET GCloud secret name (default: HUGGINGFACE_API_KEY)"
|
|
echo " --dry-run Show what would be uploaded without uploading"
|
|
echo " -h, --help Show this help"
|
|
exit 0
|
|
;;
|
|
*) echo "Unknown option: $1"; exit 1 ;;
|
|
esac
|
|
done
|
|
|
|
# ---------- auto-detect version ----------
|
|
if [ -z "$VERSION" ]; then
|
|
VERSION=$(git describe --tags --always 2>/dev/null || echo "dev")
|
|
echo "Auto-detected version: ${VERSION}"
|
|
fi
|
|
|
|
# ---------- validate model files ----------
|
|
EXPECTED_FILES=(
|
|
"pretrained-encoder.onnx"
|
|
"pretrained-heads.onnx"
|
|
"pretrained.rvf"
|
|
"room-profiles.json"
|
|
"collection-witness.json"
|
|
"config.json"
|
|
"README.md"
|
|
)
|
|
|
|
echo "=== WiFi-DensePose HuggingFace Publisher ==="
|
|
echo "Repo: ${REPO}"
|
|
echo "Version: ${VERSION}"
|
|
echo "Model dir: ${MODEL_DIR}"
|
|
echo ""
|
|
|
|
MISSING=0
|
|
for f in "${EXPECTED_FILES[@]}"; do
|
|
if [ -f "${MODEL_DIR}/${f}" ]; then
|
|
SIZE=$(stat --printf="%s" "${MODEL_DIR}/${f}" 2>/dev/null || stat -f "%z" "${MODEL_DIR}/${f}" 2>/dev/null || echo "?")
|
|
echo " [OK] ${f} (${SIZE} bytes)"
|
|
else
|
|
echo " [MISSING] ${f}"
|
|
MISSING=$((MISSING + 1))
|
|
fi
|
|
done
|
|
|
|
if [ "$MISSING" -gt 0 ]; then
|
|
echo ""
|
|
echo "WARNING: ${MISSING} expected file(s) missing from ${MODEL_DIR}/"
|
|
echo "The upload will proceed with available files only."
|
|
echo ""
|
|
fi
|
|
|
|
# Count actual files to upload
|
|
FILE_COUNT=$(find "${MODEL_DIR}" -maxdepth 1 -type f | wc -l)
|
|
if [ "$FILE_COUNT" -eq 0 ]; then
|
|
echo "ERROR: No files found in ${MODEL_DIR}/. Nothing to upload."
|
|
exit 1
|
|
fi
|
|
|
|
# ---------- dry run ----------
|
|
if [ "$DRY_RUN" = true ]; then
|
|
echo ""
|
|
echo "[DRY RUN] Would upload ${FILE_COUNT} files to https://huggingface.co/${REPO}"
|
|
echo "[DRY RUN] Files:"
|
|
find "${MODEL_DIR}" -maxdepth 1 -type f -exec basename {} \; | sort | while read -r fname; do
|
|
echo " - ${fname}"
|
|
done
|
|
echo "[DRY RUN] Version tag: ${VERSION}"
|
|
echo ""
|
|
echo "Run without --dry-run to actually upload."
|
|
exit 0
|
|
fi
|
|
|
|
# ---------- retrieve HuggingFace token ----------
|
|
echo ""
|
|
echo "Retrieving HuggingFace token from GCloud Secrets..."
|
|
HF_TOKEN=$(gcloud secrets versions access latest \
|
|
--secret="${SECRET_NAME}" \
|
|
--project="${GCLOUD_PROJECT}" 2>/dev/null)
|
|
|
|
if [ -z "$HF_TOKEN" ]; then
|
|
echo "ERROR: Failed to retrieve secret '${SECRET_NAME}' from project '${GCLOUD_PROJECT}'."
|
|
echo "Make sure you are authenticated: gcloud auth login"
|
|
echo "And have access to the secret: gcloud secrets list --project=${GCLOUD_PROJECT}"
|
|
exit 1
|
|
fi
|
|
echo "Token retrieved successfully."
|
|
|
|
# ---------- install huggingface_hub if needed ----------
|
|
if ! python3 -c "import huggingface_hub" 2>/dev/null; then
|
|
echo "Installing huggingface_hub..."
|
|
pip3 install --quiet huggingface_hub
|
|
fi
|
|
|
|
# ---------- upload via Python ----------
|
|
echo ""
|
|
echo "Uploading to https://huggingface.co/${REPO} ..."
|
|
|
|
python3 - <<PYEOF
|
|
import os
|
|
from huggingface_hub import HfApi, login
|
|
|
|
token = os.environ.get("HF_TOKEN_OVERRIDE") or """${HF_TOKEN}"""
|
|
repo_id = "${REPO}"
|
|
model_dir = "${MODEL_DIR}"
|
|
version = "${VERSION}"
|
|
|
|
login(token=token, add_to_git_credential=False)
|
|
api = HfApi()
|
|
|
|
# Create repo if it doesn't exist
|
|
api.create_repo(
|
|
repo_id=repo_id,
|
|
repo_type="model",
|
|
exist_ok=True,
|
|
private=False,
|
|
)
|
|
|
|
# Upload the entire folder
|
|
commit_info = api.upload_folder(
|
|
folder_path=model_dir,
|
|
repo_id=repo_id,
|
|
repo_type="model",
|
|
commit_message=f"Upload WiFi-DensePose pretrained models ({version})",
|
|
)
|
|
|
|
# Create a tag for this version
|
|
try:
|
|
api.create_tag(
|
|
repo_id=repo_id,
|
|
repo_type="model",
|
|
tag=version,
|
|
tag_message=f"WiFi-DensePose pretrained models {version}",
|
|
)
|
|
print(f"Tagged as: {version}")
|
|
except Exception as e:
|
|
print(f"Tag '{version}' may already exist: {e}")
|
|
|
|
print()
|
|
print("=" * 60)
|
|
print(f"Published successfully!")
|
|
print(f"URL: https://huggingface.co/{repo_id}")
|
|
print(f"Version: {version}")
|
|
print(f"Commit: {commit_info.commit_url}")
|
|
print("=" * 60)
|
|
PYEOF
|
|
|
|
echo ""
|
|
echo "Done."
|