Spaces:
Runtime error
Runtime error
Jacqueline Garrahan
commited on
Fix validity check
Browse files
src/submission/check_validity.py
CHANGED
|
@@ -35,9 +35,8 @@ def check_model_card(repo_id: str) -> tuple[bool, str]:
|
|
| 35 |
|
| 36 |
def is_model_on_hub(model_name: str, token: str = None, trust_remote_code=False, test_tokenizer=False) -> tuple[bool, str]:
|
| 37 |
"""Checks if the model model_name is on the hub, and whether it (and its tokenizer) can be loaded with AutoClasses."""
|
| 38 |
-
model_info = API.model_info(model_name, revision="main")
|
| 39 |
try:
|
| 40 |
-
model_info = API.model_info(model_name)
|
| 41 |
config = model_info.config
|
| 42 |
if test_tokenizer:
|
| 43 |
try:
|
|
@@ -52,12 +51,6 @@ def is_model_on_hub(model_name: str, token: str = None, trust_remote_code=False,
|
|
| 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 as e:
|
| 63 |
return False, "was not found on hub!", None
|
|
|
|
| 35 |
|
| 36 |
def is_model_on_hub(model_name: str, token: str = None, trust_remote_code=False, test_tokenizer=False) -> tuple[bool, str]:
|
| 37 |
"""Checks if the model model_name is on the hub, and whether it (and its tokenizer) can be loaded with AutoClasses."""
|
|
|
|
| 38 |
try:
|
| 39 |
+
model_info = API.model_info(model_name, revision="main")
|
| 40 |
config = model_info.config
|
| 41 |
if test_tokenizer:
|
| 42 |
try:
|
|
|
|
| 51 |
return (False, "'s tokenizer cannot be loaded. Is your tokenizer class in a stable transformers release, and correctly configured?", None)
|
| 52 |
return True, None, config
|
| 53 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 54 |
|
| 55 |
except Exception as e:
|
| 56 |
return False, "was not found on hub!", None
|