Fix OOM: skip AutoConfig.from_pretrained hub check at startup
Browse filesCalling is_model_on_hub (AutoConfig.from_pretrained) for every open-source
model at startup caused the Space to be OOM-killed (exit code 137).
Since result files only exist for valid models, set still_on_hub=True
unconditionally and read architecture from JSON config instead.
src/leaderboard/read_evals.py
CHANGED
|
@@ -9,7 +9,6 @@ import numpy as np
|
|
| 9 |
|
| 10 |
from src.display.formatting import make_clickable_model
|
| 11 |
from src.display.utils import AutoEvalColumn, ModelType, Tasks, Precision, WeightType
|
| 12 |
-
from src.submission.check_validity import is_model_on_hub
|
| 13 |
|
| 14 |
|
| 15 |
@dataclass
|
|
@@ -56,19 +55,13 @@ class EvalResult:
|
|
| 56 |
result_key = f"{org}_{model}_{precision.value.name}"
|
| 57 |
full_model = "/".join(org_and_model)
|
| 58 |
|
| 59 |
-
#
|
|
|
|
|
|
|
| 60 |
if config.get("api_model", False):
|
| 61 |
-
still_on_hub = True
|
| 62 |
architecture = "API"
|
| 63 |
else:
|
| 64 |
-
|
| 65 |
-
full_model, config.get("model_sha", "main"), trust_remote_code=True, test_tokenizer=False
|
| 66 |
-
)
|
| 67 |
-
architecture = "?"
|
| 68 |
-
if model_config is not None:
|
| 69 |
-
architectures = getattr(model_config, "architectures", None)
|
| 70 |
-
if architectures:
|
| 71 |
-
architecture = ";".join(architectures)
|
| 72 |
|
| 73 |
# Extract results available in this file (some results are split in several files)
|
| 74 |
results = {}
|
|
|
|
| 9 |
|
| 10 |
from src.display.formatting import make_clickable_model
|
| 11 |
from src.display.utils import AutoEvalColumn, ModelType, Tasks, Precision, WeightType
|
|
|
|
| 12 |
|
| 13 |
|
| 14 |
@dataclass
|
|
|
|
| 55 |
result_key = f"{org}_{model}_{precision.value.name}"
|
| 56 |
full_model = "/".join(org_and_model)
|
| 57 |
|
| 58 |
+
# If we have result files for a model it is valid; skip expensive hub check
|
| 59 |
+
# (AutoConfig.from_pretrained for many models causes OOM on HF Spaces free tier)
|
| 60 |
+
still_on_hub = True
|
| 61 |
if config.get("api_model", False):
|
|
|
|
| 62 |
architecture = "API"
|
| 63 |
else:
|
| 64 |
+
architecture = config.get("architecture", "?")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 65 |
|
| 66 |
# Extract results available in this file (some results are split in several files)
|
| 67 |
results = {}
|