Spaces:
Running
Running
Commit
·
20dfdf1
1
Parent(s):
2e5ce99
List coldkey
Browse files- src/__init__.py +1 -1
- src/chain_data.py +8 -8
- src/submissions.py +7 -5
- src/validator_weights.py +4 -4
- src/wandb_data.py +8 -8
src/__init__.py
CHANGED
@@ -6,4 +6,4 @@ TIMEZONE = ZoneInfo("America/Los_Angeles")
|
|
6 |
START_DATE = datetime(2024, 11, 9)
|
7 |
|
8 |
Uid: TypeAlias = int
|
9 |
-
|
|
|
6 |
START_DATE = datetime(2024, 11, 9)
|
7 |
|
8 |
Uid: TypeAlias = int
|
9 |
+
Key: TypeAlias = str
|
src/chain_data.py
CHANGED
@@ -12,7 +12,7 @@ from fiber.chain.models import Node
|
|
12 |
from substrateinterface.storage import StorageKey
|
13 |
|
14 |
from network_commitments import Decoder
|
15 |
-
from src import
|
16 |
|
17 |
DISABLE_COMMITMENTS_FETCH = int(os.getenv("DISABLE_COMMITMENTS_FETCH") or 0) > 0
|
18 |
|
@@ -54,13 +54,13 @@ class Commitment:
|
|
54 |
|
55 |
SPEC_VERSION = 7
|
56 |
NET_UID = 39
|
57 |
-
WEIGHTS_BY_MINER: dict[
|
58 |
-
VALIDATOR_IDENTITIES: dict[
|
59 |
-
COMMITMENTS: dict[
|
60 |
-
UPDATED: dict[
|
61 |
|
62 |
-
UIDS_BY_HOTKEY: dict[
|
63 |
-
HOTKEYS_BY_UID: dict[Uid,
|
64 |
|
65 |
substrate = get_substrate()
|
66 |
metagraph = Metagraph(substrate, netuid=NET_UID, load_old_nodes=False)
|
@@ -82,7 +82,7 @@ def is_validator(node: Node) -> bool:
|
|
82 |
return node.vtrust > 0 or node.stake > 10_000
|
83 |
|
84 |
|
85 |
-
def get_nodes() -> dict[
|
86 |
return metagraph.nodes
|
87 |
|
88 |
|
|
|
12 |
from substrateinterface.storage import StorageKey
|
13 |
|
14 |
from network_commitments import Decoder
|
15 |
+
from src import Key, Uid, TIMEZONE
|
16 |
|
17 |
DISABLE_COMMITMENTS_FETCH = int(os.getenv("DISABLE_COMMITMENTS_FETCH") or 0) > 0
|
18 |
|
|
|
54 |
|
55 |
SPEC_VERSION = 7
|
56 |
NET_UID = 39
|
57 |
+
WEIGHTS_BY_MINER: dict[Key, list[tuple[Key, Weight]]] = {}
|
58 |
+
VALIDATOR_IDENTITIES: dict[Key, str] = {}
|
59 |
+
COMMITMENTS: dict[Key, Commitment] = {}
|
60 |
+
UPDATED: dict[Key, int] = {}
|
61 |
|
62 |
+
UIDS_BY_HOTKEY: dict[Key, Uid] = {}
|
63 |
+
HOTKEYS_BY_UID: dict[Uid, Key] = {}
|
64 |
|
65 |
substrate = get_substrate()
|
66 |
metagraph = Metagraph(substrate, netuid=NET_UID, load_old_nodes=False)
|
|
|
82 |
return node.vtrust > 0 or node.stake > 10_000
|
83 |
|
84 |
|
85 |
+
def get_nodes() -> dict[Key, Node]:
|
86 |
return metagraph.nodes
|
87 |
|
88 |
|
src/submissions.py
CHANGED
@@ -1,12 +1,12 @@
|
|
1 |
import gradio as gr
|
2 |
import pandas as pd
|
3 |
|
4 |
-
from chain_data import sync_metagraph, COMMITMENTS, UIDS_BY_HOTKEY
|
5 |
-
from src import
|
6 |
from wandb_data import get_current_runs, Run
|
7 |
|
8 |
|
9 |
-
def get_status(run: Run, hotkey:
|
10 |
if hotkey in run.submissions and block > run.submissions[hotkey].info.block and hotkey not in run.invalid_submissions:
|
11 |
return "Pending", "orange"
|
12 |
|
@@ -25,12 +25,14 @@ def create_submissions() -> gr.Dataframe:
|
|
25 |
runs = sorted(get_current_runs(), key=lambda run: run.uid)
|
26 |
|
27 |
for hotkey, commitment in COMMITMENTS.items():
|
|
|
28 |
row = [
|
29 |
UIDS_BY_HOTKEY[hotkey],
|
30 |
f"[{'/'.join(commitment.get_repo_link().split('/')[-2:])}]({commitment.get_repo_link()})",
|
31 |
f"[{commitment.block}](https://taostats.io/block/{commitment.block})",
|
32 |
f"[{commitment.revision}]({commitment.get_repo_link()}/commit/{commitment.revision})",
|
33 |
f"[{hotkey[:6]}...](https://taostats.io/hotkey/{hotkey})",
|
|
|
34 |
commitment.contest.name,
|
35 |
]
|
36 |
|
@@ -42,8 +44,8 @@ def create_submissions() -> gr.Dataframe:
|
|
42 |
|
43 |
data.sort(key=lambda x: int(x[2].split('[')[1].split(']')[0]), reverse=True)
|
44 |
|
45 |
-
columns = ["UID", "Model", "Block", "Revision", "Hotkey", "Contest"]
|
46 |
-
datatype = ["number", "markdown", "markdown", "markdown", "markdown", "markdown"]
|
47 |
for run in runs:
|
48 |
columns.append(f"{run.uid}")
|
49 |
datatype.append("markdown")
|
|
|
1 |
import gradio as gr
|
2 |
import pandas as pd
|
3 |
|
4 |
+
from chain_data import sync_metagraph, COMMITMENTS, UIDS_BY_HOTKEY, metagraph
|
5 |
+
from src import Key
|
6 |
from wandb_data import get_current_runs, Run
|
7 |
|
8 |
|
9 |
+
def get_status(run: Run, hotkey: Key, block: int) -> tuple[str, str]:
|
10 |
if hotkey in run.submissions and block > run.submissions[hotkey].info.block and hotkey not in run.invalid_submissions:
|
11 |
return "Pending", "orange"
|
12 |
|
|
|
25 |
runs = sorted(get_current_runs(), key=lambda run: run.uid)
|
26 |
|
27 |
for hotkey, commitment in COMMITMENTS.items():
|
28 |
+
coldkey = metagraph.nodes[hotkey].coldkey
|
29 |
row = [
|
30 |
UIDS_BY_HOTKEY[hotkey],
|
31 |
f"[{'/'.join(commitment.get_repo_link().split('/')[-2:])}]({commitment.get_repo_link()})",
|
32 |
f"[{commitment.block}](https://taostats.io/block/{commitment.block})",
|
33 |
f"[{commitment.revision}]({commitment.get_repo_link()}/commit/{commitment.revision})",
|
34 |
f"[{hotkey[:6]}...](https://taostats.io/hotkey/{hotkey})",
|
35 |
+
f"[{coldkey[:6]}...](https://taostats.io/hotkey/{coldkey})",
|
36 |
commitment.contest.name,
|
37 |
]
|
38 |
|
|
|
44 |
|
45 |
data.sort(key=lambda x: int(x[2].split('[')[1].split(']')[0]), reverse=True)
|
46 |
|
47 |
+
columns = ["UID", "Model", "Block", "Revision", "Hotkey", "Coldkey", "Contest"]
|
48 |
+
datatype = ["number", "markdown", "markdown", "markdown", "markdown", "markdown", "markdown"]
|
49 |
for run in runs:
|
50 |
columns.append(f"{run.uid}")
|
51 |
datatype.append("markdown")
|
src/validator_weights.py
CHANGED
@@ -2,7 +2,7 @@ import gradio as gr
|
|
2 |
import pandas as pd
|
3 |
|
4 |
from chain_data import WEIGHTS_BY_MINER, UIDS_BY_HOTKEY, get_nodes, sync_metagraph, Weight
|
5 |
-
from wandb_data import
|
6 |
|
7 |
|
8 |
def get_color_by_weight(weight: float) -> str:
|
@@ -23,12 +23,12 @@ def get_color_by_weight(weight: float) -> str:
|
|
23 |
return f"rgb(0, {g}, 0)"
|
24 |
|
25 |
|
26 |
-
def get_active_weights() -> dict[
|
27 |
runs = get_current_runs()
|
28 |
-
weights: dict[
|
29 |
|
30 |
for hotkey, validator_weights in WEIGHTS_BY_MINER.items():
|
31 |
-
new_weights: list[tuple[
|
32 |
for validator_hotkey, weight in validator_weights:
|
33 |
if validator_hotkey in [run.hotkey for run in runs]:
|
34 |
new_weights.append((validator_hotkey, weight))
|
|
|
2 |
import pandas as pd
|
3 |
|
4 |
from chain_data import WEIGHTS_BY_MINER, UIDS_BY_HOTKEY, get_nodes, sync_metagraph, Weight
|
5 |
+
from wandb_data import Key, get_current_runs
|
6 |
|
7 |
|
8 |
def get_color_by_weight(weight: float) -> str:
|
|
|
23 |
return f"rgb(0, {g}, 0)"
|
24 |
|
25 |
|
26 |
+
def get_active_weights() -> dict[Key, list[tuple[Key, Weight]]]:
|
27 |
runs = get_current_runs()
|
28 |
+
weights: dict[Key, list[tuple[Key, Weight]]] = {}
|
29 |
|
30 |
for hotkey, validator_weights in WEIGHTS_BY_MINER.items():
|
31 |
+
new_weights: list[tuple[Key, Weight]] = []
|
32 |
for validator_hotkey, weight in validator_weights:
|
33 |
if validator_hotkey in [run.hotkey for run in runs]:
|
34 |
new_weights.append((validator_hotkey, weight))
|
src/wandb_data.py
CHANGED
@@ -7,7 +7,7 @@ import wandb
|
|
7 |
import wandb.apis.public as wapi
|
8 |
from substrateinterface import Keypair
|
9 |
|
10 |
-
from src import TIMEZONE,
|
11 |
from chain_data import UIDS_BY_HOTKEY, VALIDATOR_IDENTITIES, sync_metagraph
|
12 |
|
13 |
WANDB_RUN_PATH = os.environ["WANDB_RUN_PATH"]
|
@@ -76,8 +76,8 @@ class Run:
|
|
76 |
winner_uid: int | None
|
77 |
baseline_metrics: MetricData | None
|
78 |
total_submissions: int
|
79 |
-
submissions: dict[
|
80 |
-
invalid_submissions: set[
|
81 |
|
82 |
|
83 |
RUNS: dict[str, list[Run]] = {}
|
@@ -127,9 +127,9 @@ def _add_runs(wandb_runs: list[wapi.Run]):
|
|
127 |
|
128 |
metrics = wandb_run.summary
|
129 |
|
130 |
-
submission_info: dict[
|
131 |
-
submissions: dict[
|
132 |
-
invalid_submissions: set[
|
133 |
|
134 |
baseline_metrics: MetricData | None = None
|
135 |
if "baseline" in metrics:
|
@@ -182,11 +182,11 @@ def _add_runs(wandb_runs: list[wapi.Run]):
|
|
182 |
...
|
183 |
|
184 |
status = _status_from_run(wandb_run)
|
185 |
-
|
186 |
submissions.values(),
|
187 |
key=lambda submission: (submission.rank, submission.info.block),
|
|
|
188 |
)
|
189 |
-
winner_uid = winners[0].info.uid if winners else None
|
190 |
|
191 |
uid = int(wandb_run.config["uid"])
|
192 |
hotkey = wandb_run.config["hotkey"]
|
|
|
7 |
import wandb.apis.public as wapi
|
8 |
from substrateinterface import Keypair
|
9 |
|
10 |
+
from src import TIMEZONE, Key
|
11 |
from chain_data import UIDS_BY_HOTKEY, VALIDATOR_IDENTITIES, sync_metagraph
|
12 |
|
13 |
WANDB_RUN_PATH = os.environ["WANDB_RUN_PATH"]
|
|
|
76 |
winner_uid: int | None
|
77 |
baseline_metrics: MetricData | None
|
78 |
total_submissions: int
|
79 |
+
submissions: dict[Key, Submission]
|
80 |
+
invalid_submissions: set[Key]
|
81 |
|
82 |
|
83 |
RUNS: dict[str, list[Run]] = {}
|
|
|
127 |
|
128 |
metrics = wandb_run.summary
|
129 |
|
130 |
+
submission_info: dict[Key, SubmissionInfo] = {}
|
131 |
+
submissions: dict[Key, Submission] = {}
|
132 |
+
invalid_submissions: set[Key] = set()
|
133 |
|
134 |
baseline_metrics: MetricData | None = None
|
135 |
if "baseline" in metrics:
|
|
|
182 |
...
|
183 |
|
184 |
status = _status_from_run(wandb_run)
|
185 |
+
winner_uid = min(
|
186 |
submissions.values(),
|
187 |
key=lambda submission: (submission.rank, submission.info.block),
|
188 |
+
default=None
|
189 |
)
|
|
|
190 |
|
191 |
uid = int(wandb_run.config["uid"])
|
192 |
hotkey = wandb_run.config["hotkey"]
|