Spaces:
Paused
Paused
| """Push Run 6.1 (env precondition fix) to training Space with eval-only entrypoint. | |
| Uploads: | |
| * current repo state (so env fix + new tests are on the Space) | |
| * entrypoint_eval_only.sh AS entrypoint.sh on the Space root | |
| After this, restart the Space β it downloads the Run 6 adapter from HF Hub, | |
| runs `--only eval`, re-uploads eval/results.json + comparison.csv. | |
| """ | |
| from __future__ import annotations | |
| import os | |
| import pathlib | |
| import subprocess | |
| import sys | |
| from huggingface_hub import HfApi | |
| _PROJECT_ROOT = pathlib.Path(__file__).resolve().parent.parent | |
| os.chdir(_PROJECT_ROOT) | |
| COMMON_IGNORE = [ | |
| ".git/*", ".git", | |
| "__pycache__/*", "__pycache__", "*.pyc", "*.egg-info/*", | |
| "permanence_output/*", ".pytest_cache/*", | |
| "node_modules/*", "dashboard/dist/*", | |
| "training_runs/*", | |
| "results/*.json", | |
| "tools/upload_all.py", | |
| "tools/check_training.sh", | |
| "tools/plot_runs.py", | |
| "tools/extract_metrics.py", | |
| "*.pdf", | |
| "hackathon_pdf.txt", | |
| ] | |
| def _token() -> str: | |
| tok = os.environ.get("HF_TOKEN") | |
| if tok: | |
| return tok | |
| return subprocess.check_output(["hf", "auth", "token"], text=True).strip().splitlines()[0] | |
| def main() -> None: | |
| token = _token() | |
| api = HfApi(token=token) | |
| print("ββ Uploading Run 6.1 repo to chane335/permanence-training ββ") | |
| api.upload_folder( | |
| folder_path=".", | |
| repo_id="chane335/permanence-training", | |
| repo_type="space", | |
| ignore_patterns=COMMON_IGNORE + ["deploy/serving/*"], | |
| commit_message="Run 6.1: env precondition fix (destructive DB ops on missing tables short-circuit)", | |
| ) | |
| api.upload_file( | |
| path_or_fileobj="deploy/training/Dockerfile", | |
| path_in_repo="Dockerfile", | |
| repo_id="chane335/permanence-training", | |
| repo_type="space", | |
| commit_message="Promote training Dockerfile", | |
| ) | |
| # KEY: use the eval-only entrypoint for 6.1 | |
| api.upload_file( | |
| path_or_fileobj="deploy/training/entrypoint_eval_only.sh", | |
| path_in_repo="entrypoint.sh", | |
| repo_id="chane335/permanence-training", | |
| repo_type="space", | |
| commit_message="Use eval-only entrypoint for Run 6.1", | |
| ) | |
| api.upload_file( | |
| path_or_fileobj="deploy/training/README.md", | |
| path_in_repo="README.md", | |
| repo_id="chane335/permanence-training", | |
| repo_type="space", | |
| commit_message="Training Space README", | |
| ) | |
| print("β Uploaded. Now restart the Space to trigger eval-only run.") | |
| if __name__ == "__main__": | |
| main() | |