ticketguy commited on
Commit
09b65be
·
verified ·
1 Parent(s): d313aab

Upload run_benchmark.py

Browse files
Files changed (1) hide show
  1. run_benchmark.py +37 -0
run_benchmark.py ADDED
@@ -0,0 +1,37 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env python3
2
+ """
3
+ Little Fig — GPU Benchmark Runner (HF Jobs compatible)
4
+ Clones repo, installs deps, runs benchmark, saves results to HF Hub.
5
+ """
6
+
7
+ import os, sys, subprocess, json, time
8
+
9
+ # Clone and install
10
+ print("[SETUP] Cloning Little Fig...", flush=True)
11
+ if not os.path.exists("/app/littlefig"):
12
+ subprocess.check_call(["git", "clone", "https://github.com/ticketguy/littlefig.git", "/app/littlefig"])
13
+
14
+ print("[SETUP] Installing deps...", flush=True)
15
+ subprocess.check_call([sys.executable, "-m", "pip", "install", "-q",
16
+ "transformers", "accelerate", "peft", "bitsandbytes",
17
+ "datasets", "sentencepiece", "protobuf", "psutil", "numpy", "torch"])
18
+ subprocess.check_call([sys.executable, "-m", "pip", "install", "-q", "-e", "/app/littlefig[train]"])
19
+
20
+ # Run the benchmark
21
+ print("[SETUP] Running benchmark...", flush=True)
22
+ os.chdir("/app/littlefig")
23
+ result = subprocess.run([sys.executable, "benchmark/benchmark_gpu.py"],
24
+ capture_output=False, text=True)
25
+
26
+ # Upload results if they exist
27
+ if os.path.exists("/app/benchmark_results.json"):
28
+ from huggingface_hub import HfApi
29
+ api = HfApi()
30
+ api.upload_file(
31
+ path_or_fileobj="/app/benchmark_results.json",
32
+ path_in_repo=f"benchmark_results_{int(time.time())}.json",
33
+ repo_id="ticketguy/littlefig-benchmarks",
34
+ )
35
+ print("[DONE] Results uploaded to HF Hub", flush=True)
36
+ else:
37
+ print("[WARN] No results file found", flush=True)