adaptai / platform /aiml /mlops /sync /publish_hf.sh
ADAPT-Chase's picture
Add files using upload-large-folder tool
0daf510 verified
#!/usr/bin/env bash
set -euo pipefail
# Publish artifacts to Hugging Face LevelUp2x/e-zeropoint
# Requires: huggingface_hub[cli], git-lfs, and HUGGINGFACE_HUB_TOKEN in env (or prior CLI login)
REPO_ID=${REPO_ID:-LevelUp2x/e-zeropoint}
SRC_DIR=${1:-hf_repos/e-zeropoint}
if ! command -v huggingface-cli >/dev/null 2>&1; then
echo "[hf] huggingface-cli not found. Install with: python -m pip install -U 'huggingface_hub[cli]'" >&2
exit 2
fi
echo "[hf] Target repo: ${REPO_ID} | Source: ${SRC_DIR}"
# Ensure repo exists (private model repo)
huggingface-cli repo create "${REPO_ID#*/}" --organization "${REPO_ID%/*}" --type model --private -y || true
# Upload directory (preserves structure). Use --repo-type model for model repos.
huggingface-cli upload "${REPO_ID}" "${SRC_DIR}" --repo-type model --private --create-pr 2>/dev/null || \
huggingface-cli upload "${REPO_ID}" "${SRC_DIR}" --repo-type model --private
echo "[hf] Upload complete. View: https://huggingface.co/${REPO_ID}"