alozowski commited on
Commit
e6d10f6
β€’
1 Parent(s): 2e485f8

fix submission check logic

Browse files
src/submission/check_validity.py CHANGED
@@ -103,25 +103,35 @@ def get_model_arch(model_info: ModelInfo):
103
 
104
 
105
  def user_submission_permission(org_or_user, users_to_submission_dates, rate_limit_period, rate_limit_quota):
 
 
 
 
106
  if org_or_user not in users_to_submission_dates:
107
  return True, ""
 
108
  submission_dates = sorted(users_to_submission_dates[org_or_user])
 
 
 
 
 
 
 
109
 
110
- time_limit = (datetime.now(timezone.utc) - timedelta(days=rate_limit_period)).strftime("%Y-%m-%dT%H:%M:%SZ")
111
- submissions_after_timelimit = [d for d in submission_dates if d > time_limit]
 
 
112
 
113
  num_models_submitted_in_period = len(submissions_after_timelimit)
114
- if org_or_user in HAS_HIGHER_RATE_LIMIT:
115
- rate_limit_quota = 2 * rate_limit_quota
116
-
117
- if num_models_submitted_in_period > rate_limit_quota:
118
- error_msg = f"Organisation or user `{org_or_user}`"
119
- error_msg += f"already has {num_models_submitted_in_period} model requests submitted to the leaderboard "
120
- error_msg += f"in the last {rate_limit_period} days.\n"
121
- error_msg += (
122
- "Please wait a couple of days before resubmitting, so that everybody can enjoy using the leaderboard πŸ€—"
123
- )
124
  return False, error_msg
 
125
  return True, ""
126
 
127
 
 
103
 
104
 
105
  def user_submission_permission(org_or_user, users_to_submission_dates, rate_limit_period, rate_limit_quota):
106
+ # Increase quota first if user has higher limits
107
+ if org_or_user in HAS_HIGHER_RATE_LIMIT:
108
+ rate_limit_quota *= 2
109
+
110
  if org_or_user not in users_to_submission_dates:
111
  return True, ""
112
+
113
  submission_dates = sorted(users_to_submission_dates[org_or_user])
114
+ time_limit = datetime.now(timezone.utc) - timedelta(days=rate_limit_period)
115
+
116
+ # Convert ISO 8601 dates to datetime objects for comparison
117
+ def parse_datetime(date_str):
118
+ if date_str.endswith('Z'):
119
+ date_str = date_str[:-1] + '+00:00'
120
+ return datetime.fromisoformat(date_str)
121
 
122
+ submissions_after_timelimit = [
123
+ parse_datetime(d) for d in submission_dates
124
+ if parse_datetime(d) > time_limit
125
+ ]
126
 
127
  num_models_submitted_in_period = len(submissions_after_timelimit)
128
+
129
+ # Use >= to correctly enforce the rate limit
130
+ if num_models_submitted_in_period >= rate_limit_quota:
131
+ error_msg = f"Organisation or user `{org_or_user}` already has {num_models_submitted_in_period} model requests submitted in the last {rate_limit_period} days.\n"
132
+ error_msg += "Please wait a couple of days before resubmitting, so that everybody can enjoy using the leaderboard πŸ€—"
 
 
 
 
 
133
  return False, error_msg
134
+
135
  return True, ""
136
 
137
 
src/submission/submit.py CHANGED
@@ -63,11 +63,6 @@ def add_new_eval(
63
  if model in DO_NOT_SUBMIT_MODELS or base_model in DO_NOT_SUBMIT_MODELS:
64
  return styled_warning("Model authors have requested that their model be not submitted on the leaderboard.")
65
 
66
- if model == "CohereForAI/c4ai-command-r-plus":
67
- return styled_warning(
68
- "This model cannot be submitted manually on the leaderboard before the transformers release."
69
- )
70
-
71
  # Does the model actually exist?
72
  if revision == "":
73
  revision = "main"
 
63
  if model in DO_NOT_SUBMIT_MODELS or base_model in DO_NOT_SUBMIT_MODELS:
64
  return styled_warning("Model authors have requested that their model be not submitted on the leaderboard.")
65
 
 
 
 
 
 
66
  # Does the model actually exist?
67
  if revision == "":
68
  revision = "main"