TTimur commited on
Commit
c22b238
·
1 Parent(s): 956f344

Fix OOM: skip AutoConfig.from_pretrained hub check at startup

Browse files

Calling 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.

Files changed (1) hide show
  1. src/leaderboard/read_evals.py +4 -11
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
- # Proprietary API models are not on HF Hub; mark them as available directly
 
 
60
  if config.get("api_model", False):
61
- still_on_hub = True
62
  architecture = "API"
63
  else:
64
- still_on_hub, _, model_config = is_model_on_hub(
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 = {}