Spaces:
Running
Running
Commit
·
41936a6
1
Parent(s):
c638797
Add submission filters
Browse files- README.md +1 -1
- requirements.txt +3 -3
- src/app.py +5 -5
- src/chain_data.py +2 -2
- src/submissions.py +41 -17
- src/wandb_data.py +14 -0
README.md
CHANGED
@@ -4,7 +4,7 @@ emoji: 🏆
|
|
4 |
colorFrom: purple
|
5 |
colorTo: gray
|
6 |
sdk: gradio
|
7 |
-
sdk_version: 5.
|
8 |
app_file: src/app.py
|
9 |
pinned: true
|
10 |
---
|
|
|
4 |
colorFrom: purple
|
5 |
colorTo: gray
|
6 |
sdk: gradio
|
7 |
+
sdk_version: 5.11.0
|
8 |
app_file: src/app.py
|
9 |
pinned: true
|
10 |
---
|
requirements.txt
CHANGED
@@ -1,6 +1,6 @@
|
|
1 |
-
fiber @ git+https://github.com/rayonlabs/[email protected]
|
2 |
-
gradio==5.
|
3 |
-
wandb==0.19.
|
4 |
substrate-interface==1.7.10
|
5 |
plotly==5.24.1
|
6 |
pandas==2.2.3
|
|
|
1 |
+
fiber @ git+https://github.com/rayonlabs/fiber.git@2.1.0#egg=fiber[chain]
|
2 |
+
gradio==5.11.0
|
3 |
+
wandb==0.19.2
|
4 |
substrate-interface==1.7.10
|
5 |
plotly==5.24.1
|
6 |
pandas==2.2.3
|
src/app.py
CHANGED
@@ -3,7 +3,7 @@ import gradio as gr
|
|
3 |
from chain_data import sync_metagraph
|
4 |
from leaderboard import create_leaderboard, create_dropdown, create_baseline
|
5 |
from model_demo import create_demo
|
6 |
-
from submissions import create_submissions
|
7 |
from validator_states import create_validator_states
|
8 |
from validator_weights import create_weights
|
9 |
from wandb_data import sync
|
@@ -41,13 +41,13 @@ def main():
|
|
41 |
include_inactive_checkbox.change(lambda include_inactive: create_weights(include_inactive), [include_inactive_checkbox], [validator_weights_dataframe])
|
42 |
|
43 |
with gr.Tab("Submissions") as submissions_tab:
|
44 |
-
|
45 |
|
46 |
submissions_dataframe = gr.Dataframe()
|
47 |
-
submissions_dataframe.attach_load_event(lambda include_blacklisted: create_submissions(include_blacklisted), None, [
|
48 |
-
submissions_tab.select(lambda
|
49 |
|
50 |
-
|
51 |
|
52 |
with gr.Tab("Model Demo"):
|
53 |
create_demo()
|
|
|
3 |
from chain_data import sync_metagraph
|
4 |
from leaderboard import create_leaderboard, create_dropdown, create_baseline
|
5 |
from model_demo import create_demo
|
6 |
+
from submissions import create_submissions, DROPDOWN_OPTIONS
|
7 |
from validator_states import create_validator_states
|
8 |
from validator_weights import create_weights
|
9 |
from wandb_data import sync
|
|
|
41 |
include_inactive_checkbox.change(lambda include_inactive: create_weights(include_inactive), [include_inactive_checkbox], [validator_weights_dataframe])
|
42 |
|
43 |
with gr.Tab("Submissions") as submissions_tab:
|
44 |
+
filter_dropdown = gr.Dropdown(choices=DROPDOWN_OPTIONS, value=DROPDOWN_OPTIONS, label="Filter", container=False, multiselect=True)
|
45 |
|
46 |
submissions_dataframe = gr.Dataframe()
|
47 |
+
submissions_dataframe.attach_load_event(lambda include_blacklisted: create_submissions(include_blacklisted), None, [filter_dropdown])
|
48 |
+
submissions_tab.select(lambda submission_filter: create_submissions(submission_filter), [filter_dropdown], [submissions_dataframe])
|
49 |
|
50 |
+
filter_dropdown.change(lambda submission_filter: create_submissions(submission_filter), [filter_dropdown], [submissions_dataframe])
|
51 |
|
52 |
with gr.Tab("Model Demo"):
|
53 |
create_demo()
|
src/chain_data.py
CHANGED
@@ -74,7 +74,7 @@ def query_subtensor(storage_keys: list[StorageKey], block: int) -> list:
|
|
74 |
block_hash=substrate.get_block_hash(block),
|
75 |
)
|
76 |
except Exception:
|
77 |
-
substrate = get_substrate()
|
78 |
raise
|
79 |
|
80 |
|
@@ -214,4 +214,4 @@ def sync_metagraph():
|
|
214 |
fetch_commitments(block)
|
215 |
except Exception as e:
|
216 |
print(f"Error occurred while syncing metagraph: {e}")
|
217 |
-
substrate = get_substrate()
|
|
|
74 |
block_hash=substrate.get_block_hash(block),
|
75 |
)
|
76 |
except Exception:
|
77 |
+
substrate = get_substrate(subtensor_address=substrate.url)
|
78 |
raise
|
79 |
|
80 |
|
|
|
214 |
fetch_commitments(block)
|
215 |
except Exception as e:
|
216 |
print(f"Error occurred while syncing metagraph: {e}")
|
217 |
+
substrate = get_substrate(subtensor_address=substrate.url)
|
src/submissions.py
CHANGED
@@ -1,28 +1,47 @@
|
|
|
|
|
|
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, BLACKLISTED_HOTKEYS, BLACKLISTED_COLDKEYS
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
7 |
|
|
|
|
|
|
|
|
|
|
|
8 |
|
9 |
-
|
10 |
-
|
11 |
-
return "Blacklisted", "gray"
|
12 |
|
13 |
-
|
14 |
-
|
15 |
|
16 |
-
|
17 |
-
|
18 |
|
19 |
-
|
20 |
-
return "Invalid", "red"
|
21 |
|
22 |
-
return "Pending", "orange"
|
23 |
|
|
|
24 |
|
25 |
-
|
|
|
26 |
data: list[list] = []
|
27 |
sync_metagraph()
|
28 |
runs = sorted(get_current_runs(), key=lambda run: run.uid)
|
@@ -30,9 +49,6 @@ def create_submissions(include_blacklisted: bool) -> gr.Dataframe:
|
|
30 |
for hotkey, commitment in COMMITMENTS.items():
|
31 |
coldkey = metagraph.nodes[hotkey].coldkey
|
32 |
|
33 |
-
if not include_blacklisted and (hotkey in BLACKLISTED_HOTKEYS or coldkey in BLACKLISTED_COLDKEYS):
|
34 |
-
continue
|
35 |
-
|
36 |
row = [
|
37 |
UIDS_BY_HOTKEY[hotkey],
|
38 |
f"[{'/'.join(commitment.get_repo_link().split('/')[-2:])}]({commitment.get_repo_link()})",
|
@@ -43,9 +59,17 @@ def create_submissions(include_blacklisted: bool) -> gr.Dataframe:
|
|
43 |
commitment.contest.name,
|
44 |
]
|
45 |
|
|
|
46 |
for run in runs:
|
47 |
-
status
|
48 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
49 |
|
50 |
data.append(row)
|
51 |
|
|
|
1 |
+
from enum import Enum
|
2 |
+
|
3 |
import gradio as gr
|
4 |
import pandas as pd
|
5 |
|
6 |
from chain_data import sync_metagraph, COMMITMENTS, UIDS_BY_HOTKEY, metagraph
|
7 |
from src import Key
|
8 |
+
from wandb_data import get_current_runs, Run, BLACKLISTED_HOTKEYS, BLACKLISTED_COLDKEYS, DUPLICATE_SUBMISSIONS
|
9 |
+
|
10 |
+
|
11 |
+
class SubmissionStatus(Enum):
|
12 |
+
BLACKLISTED = ("Blacklisted", "gray")
|
13 |
+
DUPLICATE = ("Duplicate", "gray")
|
14 |
+
PENDING = ("Pending", "orange")
|
15 |
+
DONE = ("Done", "springgreen")
|
16 |
+
INVALID = ("Invalid", "red")
|
17 |
+
|
18 |
+
@staticmethod
|
19 |
+
def get_status(run: Run, hotkey: Key, coldkey: Key, block: int) -> "SubmissionStatus":
|
20 |
+
if hotkey in BLACKLISTED_HOTKEYS or coldkey in BLACKLISTED_COLDKEYS:
|
21 |
+
return SubmissionStatus.BLACKLISTED
|
22 |
|
23 |
+
if any(
|
24 |
+
submission.hotkey == hotkey
|
25 |
+
for submission in DUPLICATE_SUBMISSIONS
|
26 |
+
):
|
27 |
+
return SubmissionStatus.DUPLICATE
|
28 |
|
29 |
+
if hotkey in run.submissions and block > run.submissions[hotkey].info.block and hotkey not in run.invalid_submissions:
|
30 |
+
return SubmissionStatus.PENDING
|
|
|
31 |
|
32 |
+
if hotkey in run.submissions:
|
33 |
+
return SubmissionStatus.DONE
|
34 |
|
35 |
+
if hotkey in run.invalid_submissions:
|
36 |
+
return SubmissionStatus.INVALID
|
37 |
|
38 |
+
return SubmissionStatus.PENDING
|
|
|
39 |
|
|
|
40 |
|
41 |
+
DROPDOWN_OPTIONS = [status.value[0] for status in SubmissionStatus]
|
42 |
|
43 |
+
|
44 |
+
def create_submissions(submission_filters: list[str]) -> gr.Dataframe:
|
45 |
data: list[list] = []
|
46 |
sync_metagraph()
|
47 |
runs = sorted(get_current_runs(), key=lambda run: run.uid)
|
|
|
49 |
for hotkey, commitment in COMMITMENTS.items():
|
50 |
coldkey = metagraph.nodes[hotkey].coldkey
|
51 |
|
|
|
|
|
|
|
52 |
row = [
|
53 |
UIDS_BY_HOTKEY[hotkey],
|
54 |
f"[{'/'.join(commitment.get_repo_link().split('/')[-2:])}]({commitment.get_repo_link()})",
|
|
|
59 |
commitment.contest.name,
|
60 |
]
|
61 |
|
62 |
+
has_data = False
|
63 |
for run in runs:
|
64 |
+
status = SubmissionStatus.get_status(run, hotkey, coldkey, commitment.block)
|
65 |
+
if status.value[0] in submission_filters:
|
66 |
+
row.append(f"<span style='color: {status.value[1]}'>{status.value[0]}</span>")
|
67 |
+
has_data = True
|
68 |
+
else:
|
69 |
+
row.append("")
|
70 |
+
|
71 |
+
if not has_data:
|
72 |
+
continue
|
73 |
|
74 |
data.append(row)
|
75 |
|
src/wandb_data.py
CHANGED
@@ -6,6 +6,7 @@ from enum import Enum
|
|
6 |
import requests
|
7 |
import wandb
|
8 |
import wandb.apis.public as wapi
|
|
|
9 |
from substrateinterface import Keypair
|
10 |
|
11 |
from chain_data import UIDS_BY_HOTKEY, VALIDATOR_IDENTITIES, sync_metagraph
|
@@ -17,9 +18,17 @@ START_DATE = datetime(2024, 11, 29)
|
|
17 |
OFFSET_DAYS = 0
|
18 |
|
19 |
BLACKLIST_ENDPOINT = "https://edge-inputs.api.wombo.ai/blacklist"
|
|
|
20 |
BLACKLISTED_COLDKEYS = set()
|
21 |
BLACKLISTED_HOTKEYS = set()
|
22 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
23 |
|
24 |
class BenchmarkStatus(Enum):
|
25 |
NOT_STARTED = ("Not Started", "orange", False)
|
@@ -286,6 +295,11 @@ def _fetch_blacklisted_keys():
|
|
286 |
for coldkey in data["coldkeys"]:
|
287 |
BLACKLISTED_COLDKEYS.add(coldkey)
|
288 |
|
|
|
|
|
|
|
|
|
|
|
289 |
|
290 |
last_sync: datetime = datetime.fromtimestamp(0, TIMEZONE)
|
291 |
|
|
|
6 |
import requests
|
7 |
import wandb
|
8 |
import wandb.apis.public as wapi
|
9 |
+
from pydantic import BaseModel, RootModel
|
10 |
from substrateinterface import Keypair
|
11 |
|
12 |
from chain_data import UIDS_BY_HOTKEY, VALIDATOR_IDENTITIES, sync_metagraph
|
|
|
18 |
OFFSET_DAYS = 0
|
19 |
|
20 |
BLACKLIST_ENDPOINT = "https://edge-inputs.api.wombo.ai/blacklist"
|
21 |
+
DUPLICATE_SUBMISSIONS_ENDPOINT = "https://edge-inputs.api.wombo.ai/duplicate_submissions"
|
22 |
BLACKLISTED_COLDKEYS = set()
|
23 |
BLACKLISTED_HOTKEYS = set()
|
24 |
|
25 |
+
class DuplicateSubmission(BaseModel):
|
26 |
+
hotkey: Key
|
27 |
+
copy_of: Key
|
28 |
+
url: str
|
29 |
+
|
30 |
+
DUPLICATE_SUBMISSIONS: list[DuplicateSubmission] = []
|
31 |
+
|
32 |
|
33 |
class BenchmarkStatus(Enum):
|
34 |
NOT_STARTED = ("Not Started", "orange", False)
|
|
|
295 |
for coldkey in data["coldkeys"]:
|
296 |
BLACKLISTED_COLDKEYS.add(coldkey)
|
297 |
|
298 |
+
response = requests.get(DUPLICATE_SUBMISSIONS_ENDPOINT)
|
299 |
+
response.raise_for_status()
|
300 |
+
DUPLICATE_SUBMISSIONS.clear()
|
301 |
+
DUPLICATE_SUBMISSIONS.extend(RootModel[list[DuplicateSubmission]].model_validate_json(response.text).root)
|
302 |
+
|
303 |
|
304 |
last_sync: datetime = datetime.fromtimestamp(0, TIMEZONE)
|
305 |
|