Spaces:
Sleeping
Sleeping
tytsui commited on
Commit ·
53c87fc
1
Parent(s): 68ebcc7
update
Browse files- src/envs.py +4 -0
- src/leaderboard/student_results.py +2 -2
- src/submission/student_queue.py +4 -3
src/envs.py
CHANGED
|
@@ -23,3 +23,7 @@ EVAL_REQUESTS_PATH_BACKEND = os.path.join(CACHE_PATH, "eval-queue-bk")
|
|
| 23 |
EVAL_RESULTS_PATH_BACKEND = os.path.join(CACHE_PATH, "eval-results-bk")
|
| 24 |
|
| 25 |
API = HfApi(token=TOKEN)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 23 |
EVAL_RESULTS_PATH_BACKEND = os.path.join(CACHE_PATH, "eval-results-bk")
|
| 24 |
|
| 25 |
API = HfApi(token=TOKEN)
|
| 26 |
+
|
| 27 |
+
# Project scoping (directory names in datasets)
|
| 28 |
+
PROJ_DIR = os.environ.get("PROJ_DIR", "Proj B")
|
| 29 |
+
PROJ_ID = int(os.environ.get("PROJ_ID", "1"))
|
src/leaderboard/student_results.py
CHANGED
|
@@ -5,11 +5,11 @@ from typing import Dict, Optional, Tuple
|
|
| 5 |
import numpy as np
|
| 6 |
import pandas as pd
|
| 7 |
|
| 8 |
-
from src.envs import EVAL_RESULTS_PATH
|
| 9 |
|
| 10 |
|
| 11 |
def _load_all_attempts() -> pd.DataFrame:
|
| 12 |
-
attempts_dir = os.path.join(EVAL_RESULTS_PATH, "student_attempts")
|
| 13 |
if not os.path.isdir(attempts_dir):
|
| 14 |
return pd.DataFrame(columns=["group_id", "alias", "timestamp", "dataset", "num_examples", "accuracy", "avg_infer_ms", "total_infer_s"])
|
| 15 |
rows = []
|
|
|
|
| 5 |
import numpy as np
|
| 6 |
import pandas as pd
|
| 7 |
|
| 8 |
+
from src.envs import EVAL_RESULTS_PATH, PROJ_DIR
|
| 9 |
|
| 10 |
|
| 11 |
def _load_all_attempts() -> pd.DataFrame:
|
| 12 |
+
attempts_dir = os.path.join(EVAL_RESULTS_PATH, PROJ_DIR, "student_attempts")
|
| 13 |
if not os.path.isdir(attempts_dir):
|
| 14 |
return pd.DataFrame(columns=["group_id", "alias", "timestamp", "dataset", "num_examples", "accuracy", "avg_infer_ms", "total_infer_s"])
|
| 15 |
rows = []
|
src/submission/student_queue.py
CHANGED
|
@@ -3,7 +3,7 @@ import shutil
|
|
| 3 |
from datetime import datetime, timezone
|
| 4 |
from typing import Optional
|
| 5 |
|
| 6 |
-
from src.envs import API, QUEUE_REPO
|
| 7 |
|
| 8 |
|
| 9 |
def _file_name(path_or_obj) -> str:
|
|
@@ -36,11 +36,12 @@ def queue_student_submission(
|
|
| 36 |
group_id = group_id.strip()
|
| 37 |
alias = alias.strip() if isinstance(alias, str) else alias
|
| 38 |
ts = datetime.now(timezone.utc).strftime("%Y%m%dT%H%M%SZ")
|
| 39 |
-
|
|
|
|
| 40 |
|
| 41 |
# Prepare a small request.json metadata
|
| 42 |
request_json = {
|
| 43 |
-
"proj":
|
| 44 |
"group_id": group_id,
|
| 45 |
"alias": alias,
|
| 46 |
"timestamp": ts,
|
|
|
|
| 3 |
from datetime import datetime, timezone
|
| 4 |
from typing import Optional
|
| 5 |
|
| 6 |
+
from src.envs import API, QUEUE_REPO, PROJ_DIR, PROJ_ID
|
| 7 |
|
| 8 |
|
| 9 |
def _file_name(path_or_obj) -> str:
|
|
|
|
| 36 |
group_id = group_id.strip()
|
| 37 |
alias = alias.strip() if isinstance(alias, str) else alias
|
| 38 |
ts = datetime.now(timezone.utc).strftime("%Y%m%dT%H%M%SZ")
|
| 39 |
+
folder_name = alias if alias else group_id
|
| 40 |
+
base_path = f"{PROJ_DIR}/{folder_name}/{ts}"
|
| 41 |
|
| 42 |
# Prepare a small request.json metadata
|
| 43 |
request_json = {
|
| 44 |
+
"proj": PROJ_ID,
|
| 45 |
"group_id": group_id,
|
| 46 |
"alias": alias,
|
| 47 |
"timestamp": ts,
|