Spaces:
Runtime error
Runtime error
Added test plots
Browse files- app.py +11 -16
- requirements.txt +7 -0
app.py
CHANGED
@@ -1,5 +1,5 @@
|
|
1 |
# Code adapted from: https://huggingface.co/spaces/RaoFoundation/pretraining-leaderboard/blob/main/app.py
|
2 |
-
|
3 |
import argparse
|
4 |
import functools
|
5 |
import traceback
|
@@ -22,30 +22,23 @@ import pandas as pd
|
|
22 |
|
23 |
load_dotenv()
|
24 |
|
25 |
-
|
26 |
-
|
27 |
FONT = (
|
28 |
"""<link href="https://fonts.cdnfonts.com/css/jmh-typewriter" rel="stylesheet">"""
|
29 |
)
|
30 |
TITLE = """<h1 align="center" id="space-title" class="typewriter">Subnet 9 Leaderboard</h1>"""
|
31 |
HEADER = """<h2 align="center" class="typewriter"><a href="https://github.com/macrocosm-os/pretraining" target="_blank">Subnet 9</a> is a <a href="https://bittensor.com/" target="_blank">Bittensor</a> subnet that rewards miners for producing pretrained Foundation-Models on the <a href="https://huggingface.co/datasets/tiiuae/falcon-refinedweb" target="_blank">Falcon Refined Web dataset</a>. It acts like a continuous benchmark whereby miners are rewarded for attaining the best losses on randomly sampled pages of Falcon.<br/>The models with the best head-to-head loss on the evaluation data receive a steady emission of TAO.</h3>"""
|
32 |
|
33 |
-
demo = gr.Blocks(css=".typewriter {font-family: 'JMH Typewriter', sans-serif;}")
|
34 |
-
with demo:
|
35 |
-
gr.HTML(FONT)
|
36 |
-
gr.HTML(TITLE)
|
37 |
-
gr.HTML(HEADER)
|
38 |
-
demo.launch(share=True)
|
39 |
-
'''
|
40 |
EVALUATION_DETAILS = """<ul><li><b>Name:</b> the 🤗 Hugging Face model name (click to go to the model card)</li><li><b>Rewards / Day:</b> the expected rewards per day based on current ranking.</li><li><b>Last Average Loss:</b> the last loss value on the evaluation data for the model as calculated by a validator (lower is better)</li><li><b>UID:</b> the Bittensor UID of the miner</li><li><b>Block:</b> the Bittensor block that the model was submitted in</li></ul><br/>More stats on <a href="https://taostats.io/subnets/netuid-9/" target="_blank">taostats</a>."""
|
41 |
EVALUATION_HEADER = """<h3 align="center">Shows the latest internal evaluation statistics as calculated by the Opentensor validator</h3>"""
|
42 |
VALIDATOR_WANDB_PROJECT = "opentensor-dev/pretraining-subnet"
|
43 |
-
BENCHMARK_WANDB_PROJECT = "raofoundation/pretraining-leaderboard-data"
|
44 |
-
H4_TOKEN = os.environ.get("
|
45 |
-
API = HfApi(token=
|
46 |
WANDB_TOKEN = os.environ.get("WANDB_API_KEY", None)
|
47 |
SUBTENSOR_ENDPOINT=os.environ.get("SUBTENSOR_ENDPOINT", None)
|
48 |
-
REPO_ID = "
|
49 |
MAX_AVG_LOSS_POINTS = 1
|
50 |
RETRIES = 5
|
51 |
DELAY_SECS = 3
|
@@ -321,7 +314,7 @@ def get_benchmarks() -> Tuple[pd.DataFrame, datetime.datetime]:
|
|
321 |
|
322 |
|
323 |
def restart_space():
|
324 |
-
API.restart_space(repo_id=REPO_ID, token=
|
325 |
|
326 |
|
327 |
def main():
|
@@ -347,7 +340,7 @@ def main():
|
|
347 |
for uid, stats in validator_df.items():
|
348 |
weight_keys.update(stats[-1].keys())
|
349 |
|
350 |
-
benchmarks, benchmark_timestamp = get_benchmarks()
|
351 |
break
|
352 |
except Exception as e:
|
353 |
print(f"Failed to get data: {e}")
|
@@ -371,11 +364,13 @@ def main():
|
|
371 |
num_top_classes=10,
|
372 |
)
|
373 |
|
|
|
374 |
if benchmarks is not None:
|
375 |
with gr.Accordion("Top Model Benchmarks"):
|
376 |
gr.components.Dataframe(benchmarks)
|
377 |
gr.HTML("""<div>PPL computed using a stride of 512. See <a href='https://github.com/RaoFoundation/pretraining/blob/dev/scripts/run_benchmarks.py'>here</a> for the full code.</div>""")
|
378 |
gr.HTML(f"""<div>Last Updated: {benchmark_timestamp.strftime("%Y-%m-%d %H:%M:%S")} (UTC)</div>""")
|
|
|
379 |
|
380 |
with gr.Accordion("Evaluation Stats"):
|
381 |
gr.HTML(EVALUATION_HEADER)
|
|
|
1 |
# Code adapted from: https://huggingface.co/spaces/RaoFoundation/pretraining-leaderboard/blob/main/app.py
|
2 |
+
|
3 |
import argparse
|
4 |
import functools
|
5 |
import traceback
|
|
|
22 |
|
23 |
load_dotenv()
|
24 |
|
25 |
+
|
26 |
+
|
27 |
FONT = (
|
28 |
"""<link href="https://fonts.cdnfonts.com/css/jmh-typewriter" rel="stylesheet">"""
|
29 |
)
|
30 |
TITLE = """<h1 align="center" id="space-title" class="typewriter">Subnet 9 Leaderboard</h1>"""
|
31 |
HEADER = """<h2 align="center" class="typewriter"><a href="https://github.com/macrocosm-os/pretraining" target="_blank">Subnet 9</a> is a <a href="https://bittensor.com/" target="_blank">Bittensor</a> subnet that rewards miners for producing pretrained Foundation-Models on the <a href="https://huggingface.co/datasets/tiiuae/falcon-refinedweb" target="_blank">Falcon Refined Web dataset</a>. It acts like a continuous benchmark whereby miners are rewarded for attaining the best losses on randomly sampled pages of Falcon.<br/>The models with the best head-to-head loss on the evaluation data receive a steady emission of TAO.</h3>"""
|
32 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
33 |
EVALUATION_DETAILS = """<ul><li><b>Name:</b> the 🤗 Hugging Face model name (click to go to the model card)</li><li><b>Rewards / Day:</b> the expected rewards per day based on current ranking.</li><li><b>Last Average Loss:</b> the last loss value on the evaluation data for the model as calculated by a validator (lower is better)</li><li><b>UID:</b> the Bittensor UID of the miner</li><li><b>Block:</b> the Bittensor block that the model was submitted in</li></ul><br/>More stats on <a href="https://taostats.io/subnets/netuid-9/" target="_blank">taostats</a>."""
|
34 |
EVALUATION_HEADER = """<h3 align="center">Shows the latest internal evaluation statistics as calculated by the Opentensor validator</h3>"""
|
35 |
VALIDATOR_WANDB_PROJECT = "opentensor-dev/pretraining-subnet"
|
36 |
+
#BENCHMARK_WANDB_PROJECT = "raofoundation/pretraining-leaderboard-data"
|
37 |
+
H4_TOKEN = os.environ.get("HF_TOKEN", None)
|
38 |
+
API = HfApi(token=HF_TOKEN)
|
39 |
WANDB_TOKEN = os.environ.get("WANDB_API_KEY", None)
|
40 |
SUBTENSOR_ENDPOINT=os.environ.get("SUBTENSOR_ENDPOINT", None)
|
41 |
+
REPO_ID = "macrocosm-os/sn9"
|
42 |
MAX_AVG_LOSS_POINTS = 1
|
43 |
RETRIES = 5
|
44 |
DELAY_SECS = 3
|
|
|
314 |
|
315 |
|
316 |
def restart_space():
|
317 |
+
API.restart_space(repo_id=REPO_ID, token=HF_TOKEN)
|
318 |
|
319 |
|
320 |
def main():
|
|
|
340 |
for uid, stats in validator_df.items():
|
341 |
weight_keys.update(stats[-1].keys())
|
342 |
|
343 |
+
#benchmarks, benchmark_timestamp = get_benchmarks()
|
344 |
break
|
345 |
except Exception as e:
|
346 |
print(f"Failed to get data: {e}")
|
|
|
364 |
num_top_classes=10,
|
365 |
)
|
366 |
|
367 |
+
'''
|
368 |
if benchmarks is not None:
|
369 |
with gr.Accordion("Top Model Benchmarks"):
|
370 |
gr.components.Dataframe(benchmarks)
|
371 |
gr.HTML("""<div>PPL computed using a stride of 512. See <a href='https://github.com/RaoFoundation/pretraining/blob/dev/scripts/run_benchmarks.py'>here</a> for the full code.</div>""")
|
372 |
gr.HTML(f"""<div>Last Updated: {benchmark_timestamp.strftime("%Y-%m-%d %H:%M:%S")} (UTC)</div>""")
|
373 |
+
'''
|
374 |
|
375 |
with gr.Accordion("Evaluation Stats"):
|
376 |
gr.HTML(EVALUATION_HEADER)
|
requirements.txt
ADDED
@@ -0,0 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
bittensor==6.9.3
|
2 |
+
requests==2.31.0
|
3 |
+
wandb==0.16.2
|
4 |
+
python-dotenv==1.0.1
|
5 |
+
APScheduler==3.10.1
|
6 |
+
huggingface-hub>=0.18.0
|
7 |
+
pandas==2.2.0
|