beam-boot / scripts /upload_space_artifacts.py
StarAtNyte1's picture
Publish Beam Boot / Super Beam source
324ecd2 verified
Raw History Blame Contribute Delete
890 Bytes
"""Add reproducibility artifacts to the Space created for this project."""
import os
from pathlib import Path
import modal
app = modal.App('beamboot-artifacts')
@app.function(image=modal.Image.debian_slim(python_version='3.12'), secrets=[modal.Secret.from_name('steerability-submission-write')])
def get_token():
return os.environ['HUGGINGFACE_TOKEN']
@app.local_entrypoint()
def main():
from huggingface_hub import HfApi
api = HfApi(token=get_token.remote())
repo_id = f"{api.whoami()['name']}/beam-boot"
api.upload_folder(repo_id=repo_id, repo_type='space', folder_path=str(Path('space').resolve()),
allow_patterns=['checkpoint/**', 'beamboot/*.py', 'scripts/*.py', 'pyproject.toml'],
commit_message='Add runnable checkpoint and source')
print(f'Artifacts uploaded: https://huggingface.co/spaces/{repo_id}/tree/main')