StyleTTS-2-coreml / upload.sh
alexwengg's picture
Upload 101 files
a7fc1eb verified
#!/usr/bin/env bash
# Upload the staged StyleTTS2 CoreML artifacts to Hugging Face.
#
# Prereqs:
# - `huggingface-cli login` (or HF_TOKEN env var with write scope)
# - Repo created on HF beforehand (or pass --create on first run)
#
# Usage:
# ./upload.sh # upload to default repo
# REPO_ID=YourOrg/your-repo ./upload.sh
# ./upload.sh --create # create the repo if it doesn't exist
#
# The mlpackages in this folder are symlinks into ../coreml/. The CLI
# follows symlinks by default; if you see "skipped symlink" warnings, run
# with COPY=1 to materialize copies into a temp dir first.
set -euo pipefail
REPO_ID="${REPO_ID:-FluidInference/styletts2-libritts-coreml}"
REPO_TYPE="model"
COMMIT_MSG="${COMMIT_MSG:-Initial CoreML conversion of StyleTTS2 LibriTTS (PR #46)}"
cd "$(dirname "$0")"
if [[ "${1-}" == "--create" ]]; then
echo "==> Creating repo $REPO_ID (private; flip with --public after license review)"
huggingface-cli repo create "$REPO_ID" --type "$REPO_TYPE" -y --private
fi
echo "==> Target: https://huggingface.co/$REPO_ID"
echo "==> Reminder: this repo's weights inherit yl4579/StyleTTS2 use restrictions"
echo " (synthetic-origin disclosure + voice-clone consent). The model card"
echo " (README.md) surfaces them. Keep the repo gated until you've confirmed"
echo " the license terms in the model card match upstream."
echo
if [[ "${COPY-0}" == "1" ]]; then
STAGE="$(mktemp -d -t styletts2-hf-XXXXXX)"
echo "==> COPY=1: materializing symlinks into $STAGE"
rsync -aL ./ "$STAGE/"
SRC="$STAGE"
else
SRC="."
fi
echo "==> Uploading $SRC$REPO_ID"
huggingface-cli upload "$REPO_ID" "$SRC" . \
--repo-type "$REPO_TYPE" \
--commit-message "$COMMIT_MSG"
if [[ "${COPY-0}" == "1" ]]; then
echo "==> Cleaning $STAGE"
rm -rf "$STAGE"
fi
echo
echo "==> Done. Visit https://huggingface.co/$REPO_ID/settings"
echo " - Set repo to GATED (manual approval) until license posture is confirmed."
echo " - Add the upstream license restrictions to the access-request prompt."