-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathGNN_Agentic.py
More file actions
95 lines (75 loc) · 3.19 KB
/
Copy pathGNN_Agentic.py
File metadata and controls
95 lines (75 loc) · 3.19 KB
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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
"""FlyVis-GNN — Local LLM Exploration Loop.
Lightweight version of GNN_LLM.py for running agentic hyper-parameter
optimization locally (no SSH, no cluster submission).
Pipeline structure:
setup → batch_0 → loop { load → train(local) → artifacts → UCB → analysis → finalize }
Usage:
python GNN_Agentic.py -o generate_train_test_plot_Claude flyvis_noise_005 iterations=168
python GNN_Agentic.py -o generate_train_test_plot_Claude flyvis_noise_005 --resume
"""
import matplotlib
matplotlib.use('Agg') # set non-interactive backend before other imports
import argparse
import os
import warnings
from flyvis_gnn.LLM import (
setup_exploration,
init_slot_configs,
init_shared_files,
make_batch_info,
run_batch_0,
load_configs_and_seeds,
run_local_pipeline,
save_artifacts,
update_ucb_scores,
run_claude_analysis,
finalize_batch,
)
warnings.filterwarnings("ignore", message="pkg_resources is deprecated as an API")
def parse_args():
parser = argparse.ArgumentParser(description="FlyVis-GNN — Local LLM Exploration")
parser.add_argument("-o", "--option", nargs="+", help="option that takes multiple values")
parser.add_argument("--fresh", action="store_true", default=True,
help="start from iteration 1 (ignore auto-resume)")
parser.add_argument("--resume", action="store_true",
help="auto-resume from last completed batch")
args = parser.parse_args()
# Force local mode (no cluster)
args.cluster = False
return args
if __name__ == "__main__":
warnings.filterwarnings("ignore", category=FutureWarning)
args = parse_args()
root_dir = os.path.dirname(os.path.abspath(__file__))
# --- Setup ---
state = setup_exploration(args, root_dir)
# Disable interactive code sessions (not needed for local exploration)
state.interaction_code = False
init_slot_configs(state, is_resume=args.resume)
init_shared_files(state, is_resume=args.resume)
# --- Batch 0: initialize config variations (fresh start only) ---
if state.start_iteration == 1 and not args.resume:
run_batch_0(state)
# --- Main batch loop ---
for batch_start in range(state.start_iteration, state.n_iterations + 1, state.n_parallel):
batch = make_batch_info(state, batch_start)
print(f"\n\n\033[94m{'='*60}\033[0m")
print(f"\033[94mBATCH: iterations {batch.batch_first}-{batch.batch_last} / {state.n_iterations} (block {batch.block_number})\033[0m")
print(f"\033[94m{'='*60}\033[0m")
# Load configs + force seeds
load_configs_and_seeds(state, batch)
# Training (local only)
if "train" in state.task:
run_local_pipeline(state, batch)
else:
# No training — mark all slots as successful
for slot in range(batch.n_slots):
batch.job_results[slot] = True
# Save exploration artifacts
save_artifacts(state, batch)
# Compute UCB scores
update_ucb_scores(state, batch)
# Claude analysis + next mutations
run_claude_analysis(state, batch)
# Finalize: tree viz, protocol/memory snapshots
finalize_batch(state, batch)