Spaces:
Sleeping
Sleeping
Update interface.py
Browse files- interface.py +145 -16
interface.py
CHANGED
|
@@ -11,7 +11,19 @@ from lineage_visualizer import render_lineage_tree
|
|
| 11 |
from waveform_renderer import render_waveform
|
| 12 |
from leaderboard import generate_leaderboard
|
| 13 |
from codex.formulas import GVU_FORMULAS, rft_invariants
|
| 14 |
-
import stage1
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 15 |
|
| 16 |
# Safety guard to ensure agent has required keys
|
| 17 |
def ensure_agent_shape(agent: dict, mutation_profile: dict) -> dict:
|
|
@@ -161,23 +173,140 @@ with gr.Blocks(theme="soft") as demo:
|
|
| 161 |
with gr.Tab("Codex Reference"):
|
| 162 |
gr.Markdown("... your existing reference markdown ...")
|
| 163 |
|
| 164 |
-
|
| 165 |
-
|
| 166 |
-
|
| 167 |
-
|
| 168 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 169 |
)
|
| 170 |
-
|
| 171 |
-
|
| 172 |
-
|
| 173 |
-
|
| 174 |
-
|
| 175 |
-
|
| 176 |
-
|
| 177 |
-
|
| 178 |
-
|
| 179 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 180 |
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 181 |
|
| 182 |
if __name__ == "__main__":
|
| 183 |
demo.launch()
|
|
|
|
|
|
| 11 |
from waveform_renderer import render_waveform
|
| 12 |
from leaderboard import generate_leaderboard
|
| 13 |
from codex.formulas import GVU_FORMULAS, rft_invariants
|
| 14 |
+
import stage1
|
| 15 |
+
import stage2
|
| 16 |
+
import stage3
|
| 17 |
+
import stage4
|
| 18 |
+
import stage5
|
| 19 |
+
import stage6
|
| 20 |
+
import stage7
|
| 21 |
+
import stage8
|
| 22 |
+
import stage9
|
| 23 |
+
import stage10
|
| 24 |
+
import stage11
|
| 25 |
+
import stage12
|
| 26 |
+
|
| 27 |
|
| 28 |
# Safety guard to ensure agent has required keys
|
| 29 |
def ensure_agent_shape(agent: dict, mutation_profile: dict) -> dict:
|
|
|
|
| 173 |
with gr.Tab("Codex Reference"):
|
| 174 |
gr.Markdown("... your existing reference markdown ...")
|
| 175 |
|
| 176 |
+
# --- Validation Stages Tab ---
|
| 177 |
+
def run_stage(stage_name, mode, epochs, batch, lr):
|
| 178 |
+
if stage_name == "Stage 1 — CIFAR-10 Baseline":
|
| 179 |
+
return stage1.train(
|
| 180 |
+
mode=mode,
|
| 181 |
+
epochs=int(epochs),
|
| 182 |
+
batch=int(batch),
|
| 183 |
+
lr=float(lr),
|
| 184 |
+
log_path="stage1_cifar10_log.jsonl"
|
| 185 |
+
)
|
| 186 |
+
elif stage_name == "Stage 2 — Orbital & Agent Coupling":
|
| 187 |
+
return stage2.train(
|
| 188 |
+
mode=mode,
|
| 189 |
+
steps=int(epochs),
|
| 190 |
+
n=int(batch),
|
| 191 |
+
r0=0.165,
|
| 192 |
+
log_path="stage2_agents.jsonl"
|
| 193 |
+
)
|
| 194 |
+
elif stage_name == "Stage 3 — Unified Telemetry":
|
| 195 |
+
return stage3.train(
|
| 196 |
+
mode=mode,
|
| 197 |
+
steps=int(epochs),
|
| 198 |
+
batch=int(batch),
|
| 199 |
+
log_path="stage3_telemetry.jsonl"
|
| 200 |
+
)
|
| 201 |
+
elif stage_name == "Stage 4 — ViT-Tiny (ImageNet Subset)":
|
| 202 |
+
return stage4.train(
|
| 203 |
+
mode=mode,
|
| 204 |
+
data_dir=None,
|
| 205 |
+
steps=int(epochs),
|
| 206 |
+
batch=int(batch),
|
| 207 |
+
lr=float(lr),
|
| 208 |
+
log_path="stage4_vit_tiny.jsonl"
|
| 209 |
+
)
|
| 210 |
+
elif stage_name == "Stage 5 — ViT-Small/B32 (ImageNet Subset)":
|
| 211 |
+
return stage5.run(
|
| 212 |
+
mode=mode,
|
| 213 |
+
data_dir=None,
|
| 214 |
+
steps=int(epochs),
|
| 215 |
+
batch=int(batch),
|
| 216 |
+
lr=float(lr),
|
| 217 |
+
log="stage5_vit_small_b32.jsonl"
|
| 218 |
+
)
|
| 219 |
+
elif stage_name == "Stage 6 — ViT-Base (Full ImageNet-1K)":
|
| 220 |
+
return stage6.run(
|
| 221 |
+
mode=mode,
|
| 222 |
+
data_dir=None,
|
| 223 |
+
epochs=int(epochs),
|
| 224 |
+
batch=int(batch),
|
| 225 |
+
lr=float(lr),
|
| 226 |
+
log_path="stage6_vit_base.jsonl"
|
| 227 |
)
|
| 228 |
+
elif stage_name == "Stage 7 — CLIP Multi-Modal (Text–Image)":
|
| 229 |
+
return stage7.run(
|
| 230 |
+
mode=mode,
|
| 231 |
+
steps=int(epochs),
|
| 232 |
+
batch=int(batch),
|
| 233 |
+
lr=float(lr),
|
| 234 |
+
log="stage7_clip.jsonl"
|
| 235 |
+
)
|
| 236 |
+
elif stage_name == "Stage 8 — RFT-LLM (Language-Only Transformer)":
|
| 237 |
+
return stage8.run(
|
| 238 |
+
mode=mode,
|
| 239 |
+
steps=int(epochs),
|
| 240 |
+
batch=int(batch),
|
| 241 |
+
lr=float(lr),
|
| 242 |
+
log="stage8_llm.jsonl"
|
| 243 |
+
)
|
| 244 |
+
elif stage_name == "Stage 9 — Distributed LLM (DDP, 4×A100)":
|
| 245 |
+
return stage9.run_ddp(
|
| 246 |
+
mode=mode,
|
| 247 |
+
steps=int(epochs),
|
| 248 |
+
batch=int(batch),
|
| 249 |
+
seq=256,
|
| 250 |
+
vocab=32768,
|
| 251 |
+
lr=float(lr),
|
| 252 |
+
log="stage9_dist_llm.jsonl"
|
| 253 |
+
)
|
| 254 |
+
elif stage_name == "Stage 10 — RFT-GPT-30B (DDP, 8×A100)":
|
| 255 |
+
return stage10.run(
|
| 256 |
+
mode=mode,
|
| 257 |
+
steps=int(epochs),
|
| 258 |
+
batch=int(batch),
|
| 259 |
+
seq=1024,
|
| 260 |
+
vocab=32768,
|
| 261 |
+
lr=float(lr),
|
| 262 |
+
log="stage10_gpt30b.jsonl"
|
| 263 |
)
|
| 264 |
+
elif stage_name == "Stage 11 — RFT-GPT-70B (DDP, 16×A100)":
|
| 265 |
+
return stage11.run(
|
| 266 |
+
mode=mode,
|
| 267 |
+
steps=int(epochs),
|
| 268 |
+
batch=int(batch),
|
| 269 |
+
vocab=32768,
|
| 270 |
+
lr=float(lr),
|
| 271 |
+
log="stage11_gpt70b.jsonl"
|
| 272 |
+
)
|
| 273 |
+
elif stage_name == "Stage 12 — Production Pilot & Monitoring":
|
| 274 |
+
# Stage 12 is a monitor, not a training run; call its main entry
|
| 275 |
+
return stage12.main()
|
| 276 |
+
else:
|
| 277 |
+
return "Stage not yet implemented."
|
| 278 |
+
|
| 279 |
+
|
| 280 |
+
with gr.Tab("Validation Stages"):
|
| 281 |
+
stage = gr.Dropdown(
|
| 282 |
+
[
|
| 283 |
+
"Stage 1 — CIFAR-10 Baseline",
|
| 284 |
+
"Stage 2 — Orbital & Agent Coupling",
|
| 285 |
+
"Stage 3 — Unified Telemetry",
|
| 286 |
+
"Stage 4 — ViT-Tiny (ImageNet Subset)",
|
| 287 |
+
"Stage 5 — ViT-Small/B32 (ImageNet Subset)",
|
| 288 |
+
"Stage 6 — ViT-Base (Full ImageNet-1K)",
|
| 289 |
+
"Stage 7 — CLIP Multi-Modal (Text–Image)",
|
| 290 |
+
"Stage 8 — RFT-LLM (Language-Only Transformer)",
|
| 291 |
+
"Stage 9 — Distributed LLM (DDP, 4×A100)",
|
| 292 |
+
"Stage 10 — RFT-GPT-30B (DDP, 8×A100)",
|
| 293 |
+
"Stage 11 — RFT-GPT-70B (DDP, 16×A100)",
|
| 294 |
+
"Stage 12 — Production Pilot & Monitoring"
|
| 295 |
+
],
|
| 296 |
+
label="Select Stage"
|
| 297 |
+
)
|
| 298 |
+
mode = gr.Dropdown(["RFT", "BASE"], label="Mode")
|
| 299 |
+
epochs = gr.Number(label="Epochs/Steps", value=200)
|
| 300 |
+
batch = gr.Number(label="Batch Size", value=256)
|
| 301 |
+
lr = gr.Number(label="Learning Rate", value=5e-4)
|
| 302 |
+
val_output = gr.Textbox(label="Validation Output")
|
| 303 |
+
run_button = gr.Button("Run Stage")
|
| 304 |
+
run_button.click(
|
| 305 |
+
fn=run_stage,
|
| 306 |
+
inputs=[stage, mode, epochs, batch, lr],
|
| 307 |
+
outputs=val_output
|
| 308 |
+
)
|
| 309 |
|
| 310 |
if __name__ == "__main__":
|
| 311 |
demo.launch()
|
| 312 |
+
|