DeepFormants / scripts /upload_hub.py
FredrikKarlssonSpeech's picture
Upload DeepFormants ONNX (fp32/fp16/int8) for LPC estimator + LSTM tracker
a4bd2c0 verified
"""Upload DeepFormants-onnx artifacts to a private HF model repo.
Token: pass via env HF_TOKEN, or hard-coded fallback for local one-shot use.
Repo: FredrikKarlssonSpeech/DeepFormants (private).
"""
import os
import sys
from pathlib import Path
from huggingface_hub import HfApi, create_repo
ROOT = Path(__file__).resolve().parents[1]
REPO_ID = "FredrikKarlssonSpeech/DeepFormants"
TOKEN = os.environ.get("HF_TOKEN")
if not TOKEN:
print("ERROR: set HF_TOKEN env var before running.", file=sys.stderr)
sys.exit(2)
def main():
api = HfApi(token=TOKEN)
create_repo(
REPO_ID, token=TOKEN, repo_type="model",
private=True, exist_ok=True,
)
print(f"Repo ready: {REPO_ID} (private)")
api.upload_folder(
folder_path=ROOT.as_posix(),
repo_id=REPO_ID,
repo_type="model",
token=TOKEN,
commit_message="Upload DeepFormants ONNX (fp32/fp16/int8) for LPC estimator + LSTM tracker",
ignore_patterns=["scripts/__pycache__/*", "*.pyc", ".DS_Store"],
)
print(f"Uploaded {ROOT} -> https://huggingface.co/{REPO_ID}")
if __name__ == "__main__":
main()