File size: 1,696 Bytes
26463a3
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
#!/usr/bin/env python3
"""
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"

# Get token from env or use cached login
HF_TOKEN = os.environ.get("HF_TOKEN", "")
if HF_TOKEN:
    login(token=HF_TOKEN)
else:
    login()  # uses ~/.cache/huggingface/token

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()