Spaces:
Runtime error
Runtime error
Added more info in log and created file with the time the process was run
Browse files
app.py
CHANGED
@@ -1,6 +1,7 @@
|
|
1 |
import os
|
2 |
import json
|
3 |
import requests
|
|
|
4 |
|
5 |
import pandas as pd
|
6 |
import gradio as gr
|
@@ -76,12 +77,26 @@ def get_model_ids(rl_env):
|
|
76 |
return model_ids
|
77 |
|
78 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
79 |
# Parralelized version
|
80 |
def update_leaderboard_dataset_parallel(rl_env, path):
|
81 |
# Get model ids associated with rl_env
|
82 |
model_ids = get_model_ids(rl_env)
|
|
|
83 |
|
84 |
-
def process_model(model_id):
|
|
|
85 |
meta = get_metadata(model_id)
|
86 |
if meta is None:
|
87 |
return None
|
@@ -98,7 +113,8 @@ def update_leaderboard_dataset_parallel(rl_env, path):
|
|
98 |
row["Std Reward"] = std_reward
|
99 |
return row
|
100 |
|
101 |
-
|
|
|
102 |
|
103 |
# Filter out None results (models with no metadata)
|
104 |
data = [row for row in data if row is not None]
|
|
|
1 |
import os
|
2 |
import json
|
3 |
import requests
|
4 |
+
import datetime
|
5 |
|
6 |
import pandas as pd
|
7 |
import gradio as gr
|
|
|
77 |
return model_ids
|
78 |
|
79 |
|
80 |
+
def store_last_update_time(path):
|
81 |
+
# Get the current time
|
82 |
+
current_time = datetime.datetime.now().strftime('%Y-%m-%d %H:%M:%S')
|
83 |
+
|
84 |
+
# Create a file to store the last update time
|
85 |
+
last_update_file = os.path.join(path, "last_update.txt")
|
86 |
+
with open(last_update_file, 'w') as f:
|
87 |
+
f.write(f"Last update time: {current_time}")
|
88 |
+
|
89 |
+
print(f"Stored last update time: {current_time}")
|
90 |
+
|
91 |
+
|
92 |
# Parralelized version
|
93 |
def update_leaderboard_dataset_parallel(rl_env, path):
|
94 |
# Get model ids associated with rl_env
|
95 |
model_ids = get_model_ids(rl_env)
|
96 |
+
total_models = len(model_ids)
|
97 |
|
98 |
+
def process_model(index, model_id):
|
99 |
+
print(f"Processing model {index + 1} of {total_models}: {model_id}")
|
100 |
meta = get_metadata(model_id)
|
101 |
if meta is None:
|
102 |
return None
|
|
|
113 |
row["Std Reward"] = std_reward
|
114 |
return row
|
115 |
|
116 |
+
# Process models with index tracking
|
117 |
+
data = list(thread_map(lambda idx_model: process_model(*idx_model), enumerate(model_ids), desc="Processing models"))
|
118 |
|
119 |
# Filter out None results (models with no metadata)
|
120 |
data = [row for row in data if row is not None]
|