Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -13,15 +13,14 @@ NEW IN 17.0:
|
|
| 13 |
- Autograd Oracle: loss.backward() replaces SymPy Jacobian calculation.
|
| 14 |
- Native Torch Optimizers: Adam Polish runs directly on the GPU graph.
|
| 15 |
- Batched GPU MPRT: Explores 100k samples via pure tensor ops.
|
| 16 |
-
- Gradio Dashboard: Hardware-agnostic UI (Colab/HF spaces ready).
|
| 17 |
"""
|
| 18 |
|
| 19 |
-
import time, random, math, threading,
|
| 20 |
from functools import reduce
|
| 21 |
from typing import Optional, Callable, List, Dict, Tuple, Any, Set
|
| 22 |
from dataclasses import dataclass, field
|
| 23 |
from collections import defaultdict
|
| 24 |
-
from concurrent.futures import ThreadPoolExecutor
|
| 25 |
|
| 26 |
import numpy as np
|
| 27 |
import sympy as sp
|
|
@@ -757,8 +756,10 @@ def _hyp_mutable(p,bt,a,m):
|
|
| 757 |
def _hyp_network(p,bt,a,m): return [_make_hyp("net",bt.binding,"network","HubProp",[],{},p.variables,0.65)]
|
| 758 |
def _hyp_equilibrium(p,bt,a,m): return [_make_hyp("eql",bt.binding,"equilibrium","GradBal",[],{},p.variables,0.72)]
|
| 759 |
def _hyp_superposition(p,bt,a,m):
|
| 760 |
-
if a and len(a)>
|
| 761 |
-
|
|
|
|
|
|
|
| 762 |
return [_make_hyp("sup",nb,"superposition","Superpose",[],{},p.variables,0.58)]
|
| 763 |
return []
|
| 764 |
def _hyp_locality(p,bt,a,m): return [_make_hyp("loc",bt.binding,"locality","LocalFirst",[],{},p.variables,0.72)]
|
|
@@ -837,7 +838,9 @@ class SequenceRayTracer:
|
|
| 837 |
if not parent_baton.l9: parent_baton.l9 = RESIDUAL_ORACLE.evaluate(parent_baton.binding, base_problem)
|
| 838 |
|
| 839 |
t0=time.time()
|
| 840 |
-
|
|
|
|
|
|
|
| 841 |
output_baton = parent_baton
|
| 842 |
|
| 843 |
for hyp in hyps:
|
|
@@ -978,9 +981,17 @@ with gr.Blocks(theme=gr.themes.Monochrome(text_size="sm")) as demo:
|
|
| 978 |
gr.Markdown(f"**Compute Node:** `{DEVICE.type.upper()}` | **Engine:** `PyTorch AST + Autograd Oracle`")
|
| 979 |
btn_toggle = gr.Button("▶ START 17.0", variant="primary")
|
| 980 |
html_output = gr.HTML(refresh_dashboard())
|
|
|
|
| 981 |
btn_toggle.click(toggle_engine, inputs=None, outputs=btn_toggle)
|
| 982 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 983 |
|
| 984 |
if __name__ == "__main__":
|
| 985 |
-
print("[SYSTEM] Launching Gradio Dashboard on 0.0.0.0:7860...")
|
| 986 |
demo.launch(server_name="0.0.0.0", server_port=7860, share=False)
|
|
|
|
| 13 |
- Autograd Oracle: loss.backward() replaces SymPy Jacobian calculation.
|
| 14 |
- Native Torch Optimizers: Adam Polish runs directly on the GPU graph.
|
| 15 |
- Batched GPU MPRT: Explores 100k samples via pure tensor ops.
|
| 16 |
+
- Gradio Dashboard: Hardware-agnostic UI (Colab/HF spaces ready) with 4.x fix.
|
| 17 |
"""
|
| 18 |
|
| 19 |
+
import time, random, math, threading, warnings
|
| 20 |
from functools import reduce
|
| 21 |
from typing import Optional, Callable, List, Dict, Tuple, Any, Set
|
| 22 |
from dataclasses import dataclass, field
|
| 23 |
from collections import defaultdict
|
|
|
|
| 24 |
|
| 25 |
import numpy as np
|
| 26 |
import sympy as sp
|
|
|
|
| 756 |
def _hyp_network(p,bt,a,m): return [_make_hyp("net",bt.binding,"network","HubProp",[],{},p.variables,0.65)]
|
| 757 |
def _hyp_equilibrium(p,bt,a,m): return [_make_hyp("eql",bt.binding,"equilibrium","GradBal",[],{},p.variables,0.72)]
|
| 758 |
def _hyp_superposition(p,bt,a,m):
|
| 759 |
+
if a and len(a) > 0:
|
| 760 |
+
other_baton = random.choice(a)
|
| 761 |
+
lam = 0.5
|
| 762 |
+
nb = {v: lam * bt.binding.get(v,0) + (1-lam) * other_baton.binding.get(v,0) for v in p.variables}
|
| 763 |
return [_make_hyp("sup",nb,"superposition","Superpose",[],{},p.variables,0.58)]
|
| 764 |
return []
|
| 765 |
def _hyp_locality(p,bt,a,m): return [_make_hyp("loc",bt.binding,"locality","LocalFirst",[],{},p.variables,0.72)]
|
|
|
|
| 838 |
if not parent_baton.l9: parent_baton.l9 = RESIDUAL_ORACLE.evaluate(parent_baton.binding, base_problem)
|
| 839 |
|
| 840 |
t0=time.time()
|
| 841 |
+
# Pass all registered batons for SUPERPOSITION to blend with
|
| 842 |
+
historical_batons = list(baton_registry.values())
|
| 843 |
+
hyps = AXIOM_CONSTRUCTORS[ray.sequence[-1]](base_problem, parent_baton, historical_batons, model)
|
| 844 |
output_baton = parent_baton
|
| 845 |
|
| 846 |
for hyp in hyps:
|
|
|
|
| 981 |
gr.Markdown(f"**Compute Node:** `{DEVICE.type.upper()}` | **Engine:** `PyTorch AST + Autograd Oracle`")
|
| 982 |
btn_toggle = gr.Button("▶ START 17.0", variant="primary")
|
| 983 |
html_output = gr.HTML(refresh_dashboard())
|
| 984 |
+
|
| 985 |
btn_toggle.click(toggle_engine, inputs=None, outputs=btn_toggle)
|
| 986 |
+
|
| 987 |
+
# 17.0 Gradio 4.x Fix: Generator for live refreshing instead of 'every='
|
| 988 |
+
def auto_refresh():
|
| 989 |
+
while True:
|
| 990 |
+
time.sleep(1.0)
|
| 991 |
+
yield refresh_dashboard()
|
| 992 |
+
|
| 993 |
+
demo.load(auto_refresh, inputs=None, outputs=html_output)
|
| 994 |
|
| 995 |
if __name__ == "__main__":
|
| 996 |
+
print(f"[SYSTEM] Launching Gradio Dashboard on 0.0.0.0:7860... (Compute: {DEVICE.type})")
|
| 997 |
demo.launch(server_name="0.0.0.0", server_port=7860, share=False)
|