| |
| """ |
| Fox1.3 Direct Push - Uploads files to HF without local git |
| Run with: python3 push_direct.py |
| Requires: huggingface-cli login (or HF_TOKEN env var set) |
| """ |
| import os |
| from huggingface_hub import HfApi, login |
|
|
| REPO_ID = "teolm30/fox1.3" |
|
|
| |
| HF_TOKEN = os.environ.get("HF_TOKEN", "") |
| if HF_TOKEN: |
| login(token=HF_TOKEN) |
| else: |
| login() |
|
|
| api = HfApi() |
|
|
| FILES = [ |
| ("train.py", "Training script with LoRA fine-tuning on CodeAlpaca_20K"), |
| ("evaluate.py", "Benchmark evaluation on HumanEval + MBPP"), |
| ("requirements.txt", "Python dependencies"), |
| ("run_pipeline.sh", "One-command pipeline runner"), |
| ("push_direct.py", "Upload script"), |
| ] |
|
|
| def main(): |
| print(f"Checking access to {REPO_ID}...") |
| try: |
| api.repo_info(REPO_ID, repo_type="model") |
| print("β Repo access confirmed") |
| except Exception as e: |
| print(f"β Repo access failed: {e}") |
| return |
|
|
| print(f"\nUploading files to https://huggingface.co/{REPO_ID}...") |
| for filename, description in FILES: |
| try: |
| api.upload_file( |
| path_or_fileobj=filename, |
| path_in_repo=filename, |
| repo_id=REPO_ID, |
| repo_type="model", |
| commit_message=f"Add {filename}: {description}", |
| ) |
| print(f" β {filename}") |
| except FileNotFoundError: |
| print(f" β {filename} not found, skipping") |
| except Exception as e: |
| print(f" β {filename} failed: {e}") |
|
|
| print(f"\nβ
Done! https://huggingface.co/{REPO_ID}") |
|
|
| if __name__ == "__main__": |
| main() |
|
|