brunneis commited on
Commit
4c0c41f
1 Parent(s): bec3e1b

Update library versions, change messages

Browse files
app.py CHANGED
@@ -181,7 +181,7 @@ with demo:
181
  # choices=[i.value.name for i in Precision if i != Precision.Unknown],
182
  # label="Precision",
183
  # multiselect=False,
184
- # value="float16",
185
  # interactive=True,
186
  # )
187
  # weight_type = gr.Dropdown(
 
181
  # choices=[i.value.name for i in Precision if i != Precision.Unknown],
182
  # label="Precision",
183
  # multiselect=False,
184
+ # value="bfloat16",
185
  # interactive=True,
186
  # )
187
  # weight_type = gr.Dropdown(
requirements.txt CHANGED
@@ -12,5 +12,5 @@ pandas
12
  python-dateutil
13
  tqdm
14
  transformers
15
- tokenizers>=0.20.0
16
  sentencepiece
 
12
  python-dateutil
13
  tqdm
14
  transformers
15
+ tokenizers>=0.15.0
16
  sentencepiece
src/submission/check_validity.py CHANGED
@@ -34,33 +34,52 @@ def check_model_card(repo_id: str) -> tuple[bool, str]:
34
 
35
  return True, ""
36
 
37
-
38
- def is_model_on_hub(model_name: str, revision: str, token: str = None, trust_remote_code=False, test_tokenizer=False) -> tuple[bool, str]:
 
 
 
 
 
39
  """Checks if the model model_name is on the hub, and whether it (and its tokenizer) can be loaded with AutoClasses."""
40
- try:
41
- config = AutoConfig.from_pretrained(model_name, revision=revision, trust_remote_code=trust_remote_code, token=token)
 
 
 
 
 
42
  if test_tokenizer:
43
  try:
44
- _ = AutoTokenizer.from_pretrained(model_name, revision=revision, trust_remote_code=trust_remote_code, token=token)
 
 
 
 
 
45
  except ValueError as e:
46
  return (
47
  False,
48
- f"uses a tokenizer which is not in a transformers release: {e}",
49
- None
50
  )
51
  except Exception:
52
- return (False, "'s tokenizer cannot be loaded. Is your tokenizer class in a stable transformers release, and correctly configured?", None)
 
 
 
 
53
  return True, None, config
54
 
55
  except ValueError:
56
  return (
57
  False,
58
- "needs to be launched with `trust_remote_code=True`. For safety reason, we do not allow these models to be automatically submitted to the leaderboard.",
59
- None
60
  )
61
 
62
  except Exception:
63
- return False, "was not found on hub!", None
64
 
65
 
66
  def get_model_size(model_info: ModelInfo, precision: str = None):
 
34
 
35
  return True, ""
36
 
37
+ def is_model_on_hub(
38
+ model_name: str,
39
+ revision: str,
40
+ token: str = None,
41
+ trust_remote_code: bool = False,
42
+ test_tokenizer: bool = False,
43
+ ) -> tuple[bool, str | None, AutoConfig | None]:
44
  """Checks if the model model_name is on the hub, and whether it (and its tokenizer) can be loaded with AutoClasses."""
45
+ try:
46
+ config = AutoConfig.from_pretrained(
47
+ model_name,
48
+ revision=revision,
49
+ trust_remote_code=trust_remote_code,
50
+ token=token,
51
+ )
52
  if test_tokenizer:
53
  try:
54
+ _ = AutoTokenizer.from_pretrained(
55
+ model_name,
56
+ revision=revision,
57
+ trust_remote_code=trust_remote_code,
58
+ token=token,
59
+ )
60
  except ValueError as e:
61
  return (
62
  False,
63
+ 'uses a tokenizer which is not in a transformers release: {}'.format(e),
64
+ None,
65
  )
66
  except Exception:
67
+ return (
68
+ False,
69
+ "'s tokenizer cannot be loaded. Is your tokenizer class in a stable transformers release, and correctly configured?",
70
+ None,
71
+ )
72
  return True, None, config
73
 
74
  except ValueError:
75
  return (
76
  False,
77
+ 'needs to be launched with `trust_remote_code=True`. For safety reason, we do not allow these models to be automatically submitted to the leaderboard.',
78
+ None,
79
  )
80
 
81
  except Exception:
82
+ return False, 'was not found.', None
83
 
84
 
85
  def get_model_size(model_info: ModelInfo, precision: str = None):
src/submission/submit.py CHANGED
@@ -36,7 +36,7 @@ def add_new_eval(
36
  current_time = datetime.now(timezone.utc).strftime("%Y-%m-%dT%H:%M:%SZ")
37
 
38
  if model_type is None or model_type == "":
39
- return styled_error("Please select a model type.")
40
 
41
  # Does the model actually exist?
42
  if revision == "":
@@ -57,7 +57,7 @@ def add_new_eval(
57
  try:
58
  model_info = API.model_info(repo_id=model_name, revision=revision)
59
  except Exception:
60
- return styled_error("Could not get your model information. Please fill it up properly.")
61
 
62
  model_size = get_model_size(
63
  model_info=model_info,
@@ -68,14 +68,14 @@ def add_new_eval(
68
  try:
69
  license_title = model_info.cardData["license"]
70
  except Exception:
71
- return styled_error("Please select a license for your model")
72
 
73
  is_model_card_ok, error_msg = check_model_card(model_name)
74
  if not is_model_card_ok:
75
  return styled_error(error_msg)
76
 
77
  # Seems good, creating the eval
78
- print("Adding new eval")
79
 
80
  eval_entry = {
81
  # "model": model,
@@ -95,10 +95,10 @@ def add_new_eval(
95
  # Check for duplicate submission
96
  request_id = get_request_id(model_name, revision, precision)
97
  if request_id in REQUESTED_MODELS:
98
- return styled_warning("This model has been already submitted.")
99
  request_hash = get_request_hash(model_name, revision, precision)
100
 
101
- print("Creating eval file")
102
  OUT_DIR = f"{EVAL_REQUESTS_PATH}/{model_name}"
103
  os.makedirs(OUT_DIR, exist_ok=True)
104
 
@@ -109,13 +109,13 @@ def add_new_eval(
109
  with open(out_path, "w") as f:
110
  f.write(json.dumps(eval_entry))
111
 
112
- print("Uploading eval file")
113
  API.upload_file(
114
  path_or_fileobj=out_path,
115
  path_in_repo='{}/{}.json'.format(model_name, request_hash),
116
  repo_id=REQUESTS_REPO,
117
  repo_type="dataset",
118
- commit_message=f"Add {model_name} to eval requests",
119
  )
120
 
121
  # Remove the local file
 
36
  current_time = datetime.now(timezone.utc).strftime("%Y-%m-%dT%H:%M:%SZ")
37
 
38
  if model_type is None or model_type == "":
39
+ return styled_error("Please, select a model type.")
40
 
41
  # Does the model actually exist?
42
  if revision == "":
 
57
  try:
58
  model_info = API.model_info(repo_id=model_name, revision=revision)
59
  except Exception:
60
+ return styled_error("Could not get your model information. Please, fill it up properly.")
61
 
62
  model_size = get_model_size(
63
  model_info=model_info,
 
68
  try:
69
  license_title = model_info.cardData["license"]
70
  except Exception:
71
+ return styled_error("Please, select a license for your model.")
72
 
73
  is_model_card_ok, error_msg = check_model_card(model_name)
74
  if not is_model_card_ok:
75
  return styled_error(error_msg)
76
 
77
  # Seems good, creating the eval
78
+ print("Adding new evaluation request...")
79
 
80
  eval_entry = {
81
  # "model": model,
 
95
  # Check for duplicate submission
96
  request_id = get_request_id(model_name, revision, precision)
97
  if request_id in REQUESTED_MODELS:
98
+ return styled_warning('This model has already been submitted.')
99
  request_hash = get_request_hash(model_name, revision, precision)
100
 
101
+ print("Creating evaluation request file...")
102
  OUT_DIR = f"{EVAL_REQUESTS_PATH}/{model_name}"
103
  os.makedirs(OUT_DIR, exist_ok=True)
104
 
 
109
  with open(out_path, "w") as f:
110
  f.write(json.dumps(eval_entry))
111
 
112
+ print("Uploading evaluation file...")
113
  API.upload_file(
114
  path_or_fileobj=out_path,
115
  path_in_repo='{}/{}.json'.format(model_name, request_hash),
116
  repo_id=REQUESTS_REPO,
117
  repo_type="dataset",
118
+ commit_message=f"Add an evaluation request for {model_name}",
119
  )
120
 
121
  # Remove the local file