File size: 890 Bytes
324ecd2 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | """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')
|