Snider Virgil commited on
Commit
0600876
·
1 Parent(s): aeeba46

fix: Pillow in PEP 723 deps + capture lighteval stderr on failure

Browse files

Two fixes that landed after the first charon smoke run:

1. Pillow missing from PEP 723 deps
lighteval's task registry eagerly imports every task module at
startup (to build the discovery table). tasks/mathvista.py does
'from PIL import Image' at module load time. When uv builds a
clean venv from just eval.py's deps, PIL isn't pulled in — it
was only present on studio via some transitive. Charon's fresh
venv exposed the gap. Adding Pillow directly.

2. stderr silently swallowed in _run_model_rounds
The per-round lighteval subprocess was invoked with stdout+stderr
both → DEVNULL, so any crash (like the Pillow ImportError above)
produced no visible output and the caller just saw 'No round parquet
files produced' with no clue why. Now capturing stderr, checking
returncode, and printing the last 30 lines of stderr on failure.
stdout stays quiet (lighteval's noisy progress output is not useful
for success cases).

Found while bringing charon (first gguf worker) online — the charon
smoke surfaced both issues cleanly once we re-ran with the stderr fix.

Co-Authored-By: Virgil <virgil@lethean.io>

Files changed (1) hide show
  1. eval.py +17 -1
eval.py CHANGED
@@ -10,6 +10,7 @@
10
  # "pyarrow",
11
  # "ruamel.yaml",
12
  # "pyyaml",
 
13
  # ]
14
  # ///
15
  # SPDX-License-Identifier: EUPL-1.2
@@ -219,6 +220,11 @@ def _run_model_rounds(model_name, task, n_questions, rounds, tmp_dir, wrapper_fi
219
 
220
  wrapper_file is the absolute path to the LightevalModel subclass file
221
  (mlx_lm_wrapper.py or gguf_wrapper.py).
 
 
 
 
 
222
  """
223
  import subprocess
224
  out_paths = []
@@ -240,7 +246,17 @@ def _run_model_rounds(model_name, task, n_questions, rounds, tmp_dir, wrapper_fi
240
  "--output-dir", out_dir,
241
  ]
242
  print(f" round {r}/{rounds} @ start={samples_start} for {model_name}", flush=True)
243
- subprocess.run(cmd, check=False, stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL)
 
 
 
 
 
 
 
 
 
 
244
  parquets = glob.glob(f"{out_dir}/details/**/*.parquet", recursive=True)
245
  if parquets:
246
  out_paths.append(parquets[0])
 
10
  # "pyarrow",
11
  # "ruamel.yaml",
12
  # "pyyaml",
13
+ # "Pillow",
14
  # ]
15
  # ///
16
  # SPDX-License-Identifier: EUPL-1.2
 
220
 
221
  wrapper_file is the absolute path to the LightevalModel subclass file
222
  (mlx_lm_wrapper.py or gguf_wrapper.py).
223
+
224
+ lighteval's stdout is quiet by default (noisy progress) but stderr is
225
+ captured and emitted if a round produces no output parquet — that makes
226
+ downstream "No round parquet files produced" failures debuggable
227
+ instead of silently swallowed.
228
  """
229
  import subprocess
230
  out_paths = []
 
246
  "--output-dir", out_dir,
247
  ]
248
  print(f" round {r}/{rounds} @ start={samples_start} for {model_name}", flush=True)
249
+ result = subprocess.run(
250
+ cmd,
251
+ check=False,
252
+ stdout=subprocess.DEVNULL,
253
+ stderr=subprocess.PIPE,
254
+ text=True,
255
+ )
256
+ if result.returncode != 0:
257
+ print(f" lighteval exited {result.returncode} — stderr tail:", file=sys.stderr)
258
+ for line in (result.stderr or "").splitlines()[-30:]:
259
+ print(f" {line}", file=sys.stderr)
260
  parquets = glob.glob(f"{out_dir}/details/**/*.parquet", recursive=True)
261
  if parquets:
262
  out_paths.append(parquets[0])