Spaces:
Running
Running
Commit
·
b190717
1
Parent(s):
84168a6
Show active weights by default
Browse files- src/app.py +6 -2
- src/validator_states.py +1 -1
- src/validator_weights.py +20 -4
- src/wandb_data.py +2 -2
src/app.py
CHANGED
@@ -27,9 +27,13 @@ def main():
|
|
27 |
validator_states_tab.select(lambda: create_validator_states(), [], [validator_states_dataframe])
|
28 |
|
29 |
with gr.Tab("Validator Weights") as validator_weights_tab:
|
|
|
|
|
30 |
validator_weights_dataframe = gr.Dataframe()
|
31 |
-
validator_weights_dataframe.attach_load_event(lambda: create_weights(), None)
|
32 |
-
validator_weights_tab.select(lambda: create_weights(), [], [validator_weights_dataframe])
|
|
|
|
|
33 |
|
34 |
with gr.Tab("Model Demo"):
|
35 |
gr.Label("Coming soon!", show_label=False)
|
|
|
27 |
validator_states_tab.select(lambda: create_validator_states(), [], [validator_states_dataframe])
|
28 |
|
29 |
with gr.Tab("Validator Weights") as validator_weights_tab:
|
30 |
+
include_inactive_checkbox = gr.Checkbox(False,label="Include Inactive", container=False,)
|
31 |
+
|
32 |
validator_weights_dataframe = gr.Dataframe()
|
33 |
+
validator_weights_dataframe.attach_load_event(lambda include_inactive: create_weights(include_inactive), None, [include_inactive_checkbox])
|
34 |
+
validator_weights_tab.select(lambda include_inactive: create_weights(include_inactive), [include_inactive_checkbox], [validator_weights_dataframe])
|
35 |
+
|
36 |
+
include_inactive_checkbox.change(lambda include_inactive: create_weights(include_inactive), [include_inactive_checkbox], [validator_weights_dataframe])
|
37 |
|
38 |
with gr.Tab("Model Demo"):
|
39 |
gr.Label("Coming soon!", show_label=False)
|
src/validator_states.py
CHANGED
@@ -42,7 +42,7 @@ def create_validator_states() -> gr.Dataframe:
|
|
42 |
colorize(run.version, "springgreen" if run.version == latest_version else "red"),
|
43 |
colorize(run.status.name(), run.status.color()),
|
44 |
colorize(run.winner_uid, "springgreen" if winner_uid_mode and run.winner_uid == winner_uid_mode else "orange" if run.winner_uid else "gray"),
|
45 |
-
f"{len(run.submissions) + len(run.invalid_submissions)}/{run.total_submissions}",
|
46 |
len(run.invalid_submissions),
|
47 |
colorize(f"{timedelta(seconds=int(run.average_benchmark_time))}", "orange" if run.average_benchmark_time > AVERAGE_BENCHMARK_TIME_WARNING_THRESHOLD else "springgreen" if run.average_benchmark_time > 0 else "gray"),
|
48 |
colorize(f"{timedelta(seconds=run.eta)}", "orange" if run.eta > ETA_WARNING_THRESHOLD else "springgreen" if run.eta > 0 else "gray"),
|
|
|
42 |
colorize(run.version, "springgreen" if run.version == latest_version else "red"),
|
43 |
colorize(run.status.name(), run.status.color()),
|
44 |
colorize(run.winner_uid, "springgreen" if winner_uid_mode and run.winner_uid == winner_uid_mode else "orange" if run.winner_uid else "gray"),
|
45 |
+
f"{min(run.total_submissions, len(run.submissions) + len(run.invalid_submissions))}/{run.total_submissions}",
|
46 |
len(run.invalid_submissions),
|
47 |
colorize(f"{timedelta(seconds=int(run.average_benchmark_time))}", "orange" if run.average_benchmark_time > AVERAGE_BENCHMARK_TIME_WARNING_THRESHOLD else "springgreen" if run.average_benchmark_time > 0 else "gray"),
|
48 |
colorize(f"{timedelta(seconds=run.eta)}", "orange" if run.eta > ETA_WARNING_THRESHOLD else "springgreen" if run.eta > 0 else "gray"),
|
src/validator_weights.py
CHANGED
@@ -1,7 +1,8 @@
|
|
1 |
import gradio as gr
|
2 |
import pandas as pd
|
3 |
|
4 |
-
from chain_data import WEIGHTS_BY_MINER, INCENTIVES, sync_metagraph
|
|
|
5 |
|
6 |
|
7 |
def get_color_by_weight(weight: float) -> str:
|
@@ -21,15 +22,30 @@ def get_color_by_weight(weight: float) -> str:
|
|
21 |
g = int(255 - ((1 - progress) * 50))
|
22 |
return f"rgb(0, {g}, 0)"
|
23 |
|
24 |
-
def
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
25 |
data: list[list] = []
|
26 |
sync_metagraph()
|
27 |
|
28 |
headers = ["Miner UID", "Incentive"]
|
29 |
datatype = ["number", "markdown"]
|
30 |
|
|
|
|
|
31 |
validator_uids = set()
|
32 |
-
for validator_weights in
|
33 |
for validator_uid, _ in validator_weights:
|
34 |
validator_uids.add(validator_uid)
|
35 |
|
@@ -37,7 +53,7 @@ def create_weights() -> gr.Dataframe:
|
|
37 |
headers.append(str(validator_uid))
|
38 |
datatype.append("markdown")
|
39 |
|
40 |
-
for miner_uid, validator_weights in enumerate(
|
41 |
incentive = INCENTIVES[miner_uid]
|
42 |
row = [miner_uid, f"<span style='color: {get_color_by_weight(incentive)}'>{incentive:.{3}f}</span>"]
|
43 |
for _, weight in validator_weights:
|
|
|
1 |
import gradio as gr
|
2 |
import pandas as pd
|
3 |
|
4 |
+
from chain_data import WEIGHTS_BY_MINER, INCENTIVES, sync_metagraph, Weight
|
5 |
+
from wandb_data import Uid, get_current_runs
|
6 |
|
7 |
|
8 |
def get_color_by_weight(weight: float) -> str:
|
|
|
22 |
g = int(255 - ((1 - progress) * 50))
|
23 |
return f"rgb(0, {g}, 0)"
|
24 |
|
25 |
+
def get_active_weights() -> list[list[tuple[Uid, Weight]]]:
|
26 |
+
runs = get_current_runs()
|
27 |
+
weights: list[list[tuple[Uid, Weight]]] = []
|
28 |
+
|
29 |
+
for miner_uid, validator_weights in enumerate(WEIGHTS_BY_MINER):
|
30 |
+
new_weights: list[tuple[Uid, Weight]] = []
|
31 |
+
for validator_uid, weight in validator_weights:
|
32 |
+
if validator_uid in [run.uid for run in runs]:
|
33 |
+
new_weights.append((validator_uid, weight))
|
34 |
+
weights.append(new_weights)
|
35 |
+
|
36 |
+
return weights
|
37 |
+
|
38 |
+
def create_weights(include_inactive: bool) -> gr.Dataframe:
|
39 |
data: list[list] = []
|
40 |
sync_metagraph()
|
41 |
|
42 |
headers = ["Miner UID", "Incentive"]
|
43 |
datatype = ["number", "markdown"]
|
44 |
|
45 |
+
weights = WEIGHTS_BY_MINER if include_inactive else get_active_weights()
|
46 |
+
|
47 |
validator_uids = set()
|
48 |
+
for validator_weights in weights:
|
49 |
for validator_uid, _ in validator_weights:
|
50 |
validator_uids.add(validator_uid)
|
51 |
|
|
|
53 |
headers.append(str(validator_uid))
|
54 |
datatype.append("markdown")
|
55 |
|
56 |
+
for miner_uid, validator_weights in enumerate(weights):
|
57 |
incentive = INCENTIVES[miner_uid]
|
58 |
row = [miner_uid, f"<span style='color: {get_color_by_weight(incentive)}'>{incentive:.{3}f}</span>"]
|
59 |
for _, weight in validator_weights:
|
src/wandb_data.py
CHANGED
@@ -205,11 +205,11 @@ def _add_runs(wandb_runs: list[wapi.Run]):
|
|
205 |
start_date=date,
|
206 |
version=wandb_run.tags[1][8:],
|
207 |
uid=uid,
|
208 |
-
name=VALIDATOR_IDENTITIES.get(uid, hotkey),
|
209 |
hotkey=hotkey,
|
210 |
status=status,
|
211 |
average_benchmark_time=average_benchmark_time,
|
212 |
-
eta=int(average_benchmark_time * (len(submission_info) - len(submissions) - len(invalid_submissions))) if average_benchmark_time else 0,
|
213 |
winner_uid=winner_uid,
|
214 |
baseline_metrics=baseline_metrics,
|
215 |
total_submissions=len(submission_info),
|
|
|
205 |
start_date=date,
|
206 |
version=wandb_run.tags[1][8:],
|
207 |
uid=uid,
|
208 |
+
name=VALIDATOR_IDENTITIES.get(uid, f"{hotkey[:6]}..."),
|
209 |
hotkey=hotkey,
|
210 |
status=status,
|
211 |
average_benchmark_time=average_benchmark_time,
|
212 |
+
eta=max(int(average_benchmark_time * (len(submission_info) - len(submissions) - len(invalid_submissions))) if average_benchmark_time else 0, 0),
|
213 |
winner_uid=winner_uid,
|
214 |
baseline_metrics=baseline_metrics,
|
215 |
total_submissions=len(submission_info),
|