Spaces:
Runtime error
Runtime error
Commit
β’
a1f3b5b
1
Parent(s):
92dcf47
Small updates for the leaderboard
Browse files
app.py
CHANGED
@@ -3,10 +3,10 @@ import pandas as pd
|
|
3 |
from tqdm.auto import tqdm
|
4 |
from utils import *
|
5 |
import gradio as gr
|
|
|
6 |
from huggingface_hub import HfApi, hf_hub_download
|
7 |
from huggingface_hub.repocard import metadata_load
|
8 |
|
9 |
-
|
10 |
class DeepRL_Leaderboard:
|
11 |
def __init__(self) -> None:
|
12 |
self.leaderboard= {}
|
@@ -16,20 +16,17 @@ class DeepRL_Leaderboard:
|
|
16 |
id = id.strip()
|
17 |
title = title.strip()
|
18 |
self.leaderboard.update({id:{'title':title,'data':get_data_per_env(id)}})
|
|
|
19 |
def get_data(self):
|
20 |
return self.leaderboard
|
21 |
|
22 |
def get_ids(self):
|
23 |
return list(self.leaderboard.keys())
|
24 |
|
25 |
-
|
26 |
-
|
27 |
# CSS file for the
|
28 |
with open('app.css','r') as f:
|
29 |
BLOCK_CSS = f.read()
|
30 |
|
31 |
-
|
32 |
-
|
33 |
LOADED_MODEL_IDS = {}
|
34 |
LOADED_MODEL_METADATA = {}
|
35 |
|
@@ -83,17 +80,17 @@ def get_data_per_env(rl_env):
|
|
83 |
|
84 |
|
85 |
rl_leaderboard = DeepRL_Leaderboard()
|
86 |
-
rl_leaderboard.add_leaderboard('
|
87 |
-
rl_leaderboard.add_leaderboard('MountainCar-v0',"The Mountain Car β°οΈ π Leaderboard")
|
88 |
rl_leaderboard.add_leaderboard('LunarLander-v2',"The Lunar Lander π Leaderboard")
|
89 |
-
rl_leaderboard.add_leaderboard('BipedalWalker-v3',"The BipedalWalker Leaderboard")
|
90 |
-
rl_leaderboard.add_leaderboard('Taxi-v3','The Taxi-v3π Leaderboard')
|
91 |
rl_leaderboard.add_leaderboard('FrozenLake-v1-4x4-no_slippery','The FrozenLake-v1-4x4-no_slippery Leaderboard')
|
92 |
rl_leaderboard.add_leaderboard('FrozenLake-v1-8x8-no_slippery','The FrozenLake-v1-8x8-no_slippery Leaderboard')
|
93 |
rl_leaderboard.add_leaderboard('FrozenLake-v1-4x4','The FrozenLake-v1-4x4 Leaderboard')
|
94 |
rl_leaderboard.add_leaderboard('FrozenLake-v1-8x8','The FrozenLake-v1-8x8 Leaderboard')
|
|
|
|
|
|
|
|
|
95 |
rl_leaderboard.add_leaderboard('SpaceInvadersNoFrameskip-v4','The SpaceInvadersNoFrameskip-v4 Leaderboard')
|
96 |
-
rl_leaderboard.add_leaderboard('CartPole-v1','The Cartpole-v1 Leaderboard')
|
97 |
rl_leaderboard.add_leaderboard('Pong-PLE-v0','The Pong-PLE-v0 πΎ Leaderboard')
|
98 |
rl_leaderboard.add_leaderboard('Walker2DBulletEnv-v0','The Walker2DBulletEnv-v0 π€ Leaderboard')
|
99 |
rl_leaderboard.add_leaderboard('AntBulletEnv-v0','The AntBulletEnv-v0 πΈοΈ Leaderboard')
|
@@ -102,15 +99,11 @@ RL_ENVS = rl_leaderboard.get_ids()
|
|
102 |
RL_DETAILS = rl_leaderboard.get_data()
|
103 |
|
104 |
|
105 |
-
|
106 |
def update_data(rl_env):
|
107 |
global LOADED_MODEL_IDS,LOADED_MODEL_METADATA
|
108 |
data = []
|
109 |
-
model_ids = [x for x in get_model_ids(rl_env) if x not in LOADED_MODEL_IDS[rl_env]]
|
110 |
|
111 |
-
#model_ids = [x for x in get_model_ids(rl_env) if x not in LOADED_MODEL_IDS[rl_env] or LOADED_MODEL_METADATA[x]!=get_metadata(x)] this still calls get_metadata() so won't work
|
112 |
-
#model_ids = [x for x in get_model_ids(rl_env)]
|
113 |
-
|
114 |
LOADED_MODEL_IDS[rl_env]+=model_ids
|
115 |
|
116 |
for model_id in tqdm(model_ids):
|
@@ -134,7 +127,6 @@ def update_data(rl_env):
|
|
134 |
return pd.DataFrame.from_records(data)
|
135 |
|
136 |
|
137 |
-
|
138 |
def update_data_per_env(rl_env):
|
139 |
global RL_DETAILS
|
140 |
|
@@ -165,8 +157,6 @@ def update_data_per_env(rl_env):
|
|
165 |
return html,dataframe,dataframe.empty
|
166 |
|
167 |
|
168 |
-
|
169 |
-
|
170 |
def get_info_display(dataframe,env_name,name_leaderboard,is_empty):
|
171 |
if not is_empty:
|
172 |
markdown = """
|
@@ -175,7 +165,7 @@ def get_info_display(dataframe,env_name,name_leaderboard,is_empty):
|
|
175 |
<br>
|
176 |
<p> This is a leaderboard of <b>{len_dataframe}</b> agents, from <b>{num_unique_users}</b> unique users, playing {env_name} π©βπ. </p>
|
177 |
<br>
|
178 |
-
<p> We use lower bound result to sort the models: mean_reward - std_reward
|
179 |
<br>
|
180 |
<p> You can click on the model's name to be redirected to its model card which includes documentation. </p>
|
181 |
<br>
|
|
|
3 |
from tqdm.auto import tqdm
|
4 |
from utils import *
|
5 |
import gradio as gr
|
6 |
+
|
7 |
from huggingface_hub import HfApi, hf_hub_download
|
8 |
from huggingface_hub.repocard import metadata_load
|
9 |
|
|
|
10 |
class DeepRL_Leaderboard:
|
11 |
def __init__(self) -> None:
|
12 |
self.leaderboard= {}
|
|
|
16 |
id = id.strip()
|
17 |
title = title.strip()
|
18 |
self.leaderboard.update({id:{'title':title,'data':get_data_per_env(id)}})
|
19 |
+
|
20 |
def get_data(self):
|
21 |
return self.leaderboard
|
22 |
|
23 |
def get_ids(self):
|
24 |
return list(self.leaderboard.keys())
|
25 |
|
|
|
|
|
26 |
# CSS file for the
|
27 |
with open('app.css','r') as f:
|
28 |
BLOCK_CSS = f.read()
|
29 |
|
|
|
|
|
30 |
LOADED_MODEL_IDS = {}
|
31 |
LOADED_MODEL_METADATA = {}
|
32 |
|
|
|
80 |
|
81 |
|
82 |
rl_leaderboard = DeepRL_Leaderboard()
|
83 |
+
rl_leaderboard.add_leaderboard('CartPole-v1','The Cartpole-v1 Leaderboard')
|
|
|
84 |
rl_leaderboard.add_leaderboard('LunarLander-v2',"The Lunar Lander π Leaderboard")
|
|
|
|
|
85 |
rl_leaderboard.add_leaderboard('FrozenLake-v1-4x4-no_slippery','The FrozenLake-v1-4x4-no_slippery Leaderboard')
|
86 |
rl_leaderboard.add_leaderboard('FrozenLake-v1-8x8-no_slippery','The FrozenLake-v1-8x8-no_slippery Leaderboard')
|
87 |
rl_leaderboard.add_leaderboard('FrozenLake-v1-4x4','The FrozenLake-v1-4x4 Leaderboard')
|
88 |
rl_leaderboard.add_leaderboard('FrozenLake-v1-8x8','The FrozenLake-v1-8x8 Leaderboard')
|
89 |
+
rl_leaderboard.add_leaderboard('Taxi-v3','The Taxi-v3π Leaderboard')
|
90 |
+
rl_leaderboard.add_leaderboard('CarRacing-v0'," The Car Racing ποΈ Leaderboard")
|
91 |
+
rl_leaderboard.add_leaderboard('MountainCar-v0',"The Mountain Car β°οΈ π Leaderboard")
|
92 |
+
rl_leaderboard.add_leaderboard('BipedalWalker-v3',"The BipedalWalker Leaderboard")
|
93 |
rl_leaderboard.add_leaderboard('SpaceInvadersNoFrameskip-v4','The SpaceInvadersNoFrameskip-v4 Leaderboard')
|
|
|
94 |
rl_leaderboard.add_leaderboard('Pong-PLE-v0','The Pong-PLE-v0 πΎ Leaderboard')
|
95 |
rl_leaderboard.add_leaderboard('Walker2DBulletEnv-v0','The Walker2DBulletEnv-v0 π€ Leaderboard')
|
96 |
rl_leaderboard.add_leaderboard('AntBulletEnv-v0','The AntBulletEnv-v0 πΈοΈ Leaderboard')
|
|
|
99 |
RL_DETAILS = rl_leaderboard.get_data()
|
100 |
|
101 |
|
|
|
102 |
def update_data(rl_env):
|
103 |
global LOADED_MODEL_IDS,LOADED_MODEL_METADATA
|
104 |
data = []
|
105 |
+
model_ids = [x for x in get_model_ids(rl_env)] #if x not in LOADED_MODEL_IDS[rl_env]] # For now let's update all
|
106 |
|
|
|
|
|
|
|
107 |
LOADED_MODEL_IDS[rl_env]+=model_ids
|
108 |
|
109 |
for model_id in tqdm(model_ids):
|
|
|
127 |
return pd.DataFrame.from_records(data)
|
128 |
|
129 |
|
|
|
130 |
def update_data_per_env(rl_env):
|
131 |
global RL_DETAILS
|
132 |
|
|
|
157 |
return html,dataframe,dataframe.empty
|
158 |
|
159 |
|
|
|
|
|
160 |
def get_info_display(dataframe,env_name,name_leaderboard,is_empty):
|
161 |
if not is_empty:
|
162 |
markdown = """
|
|
|
165 |
<br>
|
166 |
<p> This is a leaderboard of <b>{len_dataframe}</b> agents, from <b>{num_unique_users}</b> unique users, playing {env_name} π©βπ. </p>
|
167 |
<br>
|
168 |
+
<p> We use <b>lower bound result to sort the models: mean_reward - std_reward.</b> </p>
|
169 |
<br>
|
170 |
<p> You can click on the model's name to be redirected to its model card which includes documentation. </p>
|
171 |
<br>
|