chrisjay commited on
Commit
9574493
β€’
1 Parent(s): ef764db

work on issue 40

Browse files
Files changed (2) hide show
  1. app.py +9 -7
  2. utils.py +6 -0
app.py CHANGED
@@ -31,15 +31,17 @@ with open('app.css','r') as f:
31
 
32
 
33
  LOADED_MODEL_IDS = {}
 
34
 
35
  def get_data(rl_env):
36
- global LOADED_MODEL_IDS
37
  data = []
38
  model_ids = get_model_ids(rl_env)
39
  LOADED_MODEL_IDS[rl_env]=model_ids
40
 
41
  for model_id in tqdm(model_ids):
42
  meta = get_metadata(model_id)
 
43
  if meta is None:
44
  continue
45
  user_id = model_id.split('/')[0]
@@ -90,7 +92,7 @@ rl_leaderboard.add_leaderboard('FrozenLake-v1-4x4-no_slippery','The FrozenLake-v
90
  rl_leaderboard.add_leaderboard('FrozenLake-v1-8x8-no_slippery','The FrozenLake-v1-8x8-no_slippery Leaderboard πŸš€')
91
  rl_leaderboard.add_leaderboard('FrozenLake-v1-4x4','The FrozenLake-v1-4x4 Leaderboard πŸš€')
92
  rl_leaderboard.add_leaderboard('FrozenLake-v1-8x8','The FrozenLake-v1-8x8 Leaderboard πŸš€')
93
- #rl_leaderboard.add_leaderboard('SpaceInvadersNoFrameskip-v4','The SpaceInvadersNoFrameskip-v4 Leaderboard πŸš€')
94
 
95
 
96
  RL_ENVS = rl_leaderboard.get_ids()
@@ -98,17 +100,17 @@ RL_DETAILS = rl_leaderboard.get_data()
98
 
99
 
100
 
101
-
102
-
103
-
104
  def update_data(rl_env):
105
- global LOADED_MODEL_IDS
106
  data = []
107
- model_ids = [x for x in get_model_ids(rl_env) if x not in LOADED_MODEL_IDS[rl_env]]
 
 
108
  LOADED_MODEL_IDS[rl_env]+=model_ids
109
 
110
  for model_id in tqdm(model_ids):
111
  meta = get_metadata(model_id)
 
112
  if meta is None:
113
  continue
114
  user_id = model_id.split('/')[0]
 
31
 
32
 
33
  LOADED_MODEL_IDS = {}
34
+ LOADED_MODEL_METADATA = {}
35
 
36
  def get_data(rl_env):
37
+ global LOADED_MODEL_IDS ,LOADED_MODEL_METADATA
38
  data = []
39
  model_ids = get_model_ids(rl_env)
40
  LOADED_MODEL_IDS[rl_env]=model_ids
41
 
42
  for model_id in tqdm(model_ids):
43
  meta = get_metadata(model_id)
44
+ LOADED_MODEL_METADATA[model_id] = meta if meta is not None else ''
45
  if meta is None:
46
  continue
47
  user_id = model_id.split('/')[0]
 
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
 
97
 
98
  RL_ENVS = rl_leaderboard.get_ids()
 
100
 
101
 
102
 
 
 
 
103
  def update_data(rl_env):
104
+ global LOADED_MODEL_IDS,LOADED_MODEL_METADATA
105
  data = []
106
+ #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
107
+ model_ids = [x for x in get_model_ids(rl_env)]
108
+
109
  LOADED_MODEL_IDS[rl_env]+=model_ids
110
 
111
  for model_id in tqdm(model_ids):
112
  meta = get_metadata(model_id)
113
+ LOADED_MODEL_METADATA[model_id] = meta if meta is not None else ''
114
  if meta is None:
115
  continue
116
  user_id = model_id.split('/')[0]
utils.py CHANGED
@@ -48,10 +48,16 @@ def parse_rewards(accuracy):
48
  default_std = -1000
49
  default_reward=-1000
50
  if accuracy != None:
 
 
51
  parsed = accuracy.split(' +/- ')
52
  if len(parsed)>1:
53
  mean_reward = float(parsed[0])
54
  std_reward = float(parsed[1])
 
 
 
 
55
  else:
56
  mean_reward = float(default_std)
57
  std_reward = float(default_reward)
 
48
  default_std = -1000
49
  default_reward=-1000
50
  if accuracy != None:
51
+ if type(accuracy)!=str: # Always convert to string
52
+ accuracy = str(accuracy)
53
  parsed = accuracy.split(' +/- ')
54
  if len(parsed)>1:
55
  mean_reward = float(parsed[0])
56
  std_reward = float(parsed[1])
57
+ elif len(parsed)==1: #only mean reward
58
+ mean_reward = float(parsed[0])
59
+ std_reward = float(0)
60
+
61
  else:
62
  mean_reward = float(default_std)
63
  std_reward = float(default_reward)