Phocinae-Largha-150M-v1 / push_script.sh
perrylink's picture
v0.1.0 initial release — Phocinae-Largha-150M-v1 (Largha, spotted seal)
e71d16d verified
Raw History Blame
1.79 kB
#!/usr/bin/env bash
# ============================================================
# Phocinae-Largha-150M-v1 — HF push script (T-day: 2026-10-08)
# ============================================================
# PREP-ONLY: this script must NOT be run before T-day, and is
# executed by the release main session, not by the prep chain.
#
# Usage (run from this directory, i.e. hf_repo/):
# HF_TOKEN=hf_xxx bash push_script.sh
#
# Requirements: huggingface-cli (pip install huggingface_hub),
# write token for the org "Phocinae".
# ------------------------------------------------------------
set -euo pipefail
cd "$(dirname "$0")"
# Mirror endpoint for the push; disable XET so the upload uses
# the classic HTTPS path (avoiding XET-specific edge cases).
export HF_ENDPOINT=https://hf-mirror.com
export HF_HUB_DISABLE_XET=1
REPO="Phocinae/Phocinae-Largha-150M-v1"
EXPECTED_SHA="db79d5ee2f16597f34e564f5a4363bddb5b5bbd9827c01819725dabcc7802697"
if [[ -z "${HF_TOKEN:-}" ]]; then
echo "ERROR: HF_TOKEN is not set (Phocinae org write token required)." >&2
exit 1
fi
if ! command -v huggingface-cli >/dev/null 2>&1; then
echo "ERROR: huggingface-cli not found. Install with: pip install huggingface_hub" >&2
exit 1
fi
# Pre-push integrity check: the weights must match the recorded sha256.
ACTUAL_SHA=$(sha256sum model.safetensors | awk '{print $1}')
if [[ "$ACTUAL_SHA" != "$EXPECTED_SHA" ]]; then
echo "ERROR: model.safetensors sha256 mismatch!" >&2
echo " expected: $EXPECTED_SHA" >&2
echo " actual: $ACTUAL_SHA" >&2
exit 1
fi
echo "sha256 OK: $ACTUAL_SHA"
echo "Pushing repo: $REPO (HF_ENDPOINT=$HF_ENDPOINT, HF_HUB_DISABLE_XET=$HF_HUB_DISABLE_XET)"
huggingface-cli upload "$REPO" . --repo-type model
echo "Push complete. Verify at: https://hf-mirror.com/$REPO"