Shaltiel commited on
Commit
15b1ab3
1 Parent(s): 87ef24d

Updated counters to use use info

Browse files
main_backend_lighteval.py CHANGED
@@ -88,23 +88,21 @@ def run_auto_eval():
88
 
89
  # next, check to see who made the last commit to this repo - keep track of that. One person shouldn't commit more
90
  # than 4 models in one month.
91
- commits = API.list_repo_commits(eval_request.model, revision=eval_request.revision)
92
- users = commits[0].authors
93
- for user in users:
94
- if user in requests_seen and len(requests_seen[user]) >= 4:
95
- set_eval_request(
96
- api=API,
97
- eval_request=eval_request,
98
- set_to_status=FAILED_STATUS,
99
- hf_repo=QUEUE_REPO,
100
- local_dir=EVAL_REQUESTS_PATH_BACKEND,
101
- )
102
- pp.pprint(dict(message="Reached maximum cap for requests for this user this month", counter=counter_key, user=user))
103
- return
104
- if not user in requests_seen:
105
- requests_seen[user] = []
106
- requests_seen[user].append(dict(model_id=eval_request.model, revision=eval_request.revision))
107
 
 
108
  requests_seen[counter_key] += 1
109
  set_requests_seen(
110
  api=API,
 
88
 
89
  # next, check to see who made the last commit to this repo - keep track of that. One person shouldn't commit more
90
  # than 4 models in one month.
91
+ user = eval_request.user_info['name']
92
+ if user in requests_seen and len(requests_seen[user]) >= 4:
93
+ set_eval_request(
94
+ api=API,
95
+ eval_request=eval_request,
96
+ set_to_status=FAILED_STATUS,
97
+ hf_repo=QUEUE_REPO,
98
+ local_dir=EVAL_REQUESTS_PATH_BACKEND,
99
+ )
100
+ pp.pprint(dict(message="Reached maximum cap for requests for this user this month", counter=counter_key, user=user))
101
+ return
102
+ if not user in requests_seen:
103
+ requests_seen[user] = []
 
 
 
104
 
105
+ requests_seen[user].append(dict(model_id=eval_request.model, revision=eval_request.revision))
106
  requests_seen[counter_key] += 1
107
  set_requests_seen(
108
  api=API,
src/backend/manage_requests.py CHANGED
@@ -24,6 +24,7 @@ class EvalRequest:
24
  likes: Optional[int] = 0
25
  params: Optional[int] = None
26
  license: Optional[str] = ""
 
27
 
28
  def get_model_args(self):
29
  model_args = f"pretrained={self.model},revision={self.revision}"
 
24
  likes: Optional[int] = 0
25
  params: Optional[int] = None
26
  license: Optional[str] = ""
27
+ user_info: Optional[dict] = None
28
 
29
  def get_model_args(self):
30
  model_args = f"pretrained={self.model},revision={self.revision}"