Make code_eval reliable in fleets: pin filelock and isolate metrics cache per batch#1
Open
maxidl wants to merge 2 commits into
Open
Make code_eval reliable in fleets: pin filelock and isolate metrics cache per batch#1maxidl wants to merge 2 commits into
maxidl wants to merge 2 commits into
Conversation
HF `evaluate` metrics (code_eval, bleu, rouge, ...) write a compute-cache file named only by experiment_id: $HF_METRICS_CACHE/code_eval/default/default_experiment-1-0.arrow HF_METRICS_CACHE defaults to $HF_HOME/metrics, typically on shared storage. When lm-eval batches run concurrently (parallel_tasks > 1, and across jobs that share HF_HOME) they all use that one file and race on evaluate's os.remove() cleanup: one process finishes and removes it, the next crashes with FileNotFoundError and takes its whole batch (up to task_batch_size tasks) down as collateral. Point each batch at its own node-local HF_METRICS_CACHE ($TMPDIR/eh_metrics_$SLURM_JOB_ID_$BATCH_IDX) so concurrent code_eval runs can't collide. Verified on a 31-checkpoint fleet: without it ~2 code-containing batches per job failed; with it, 0 failures and all code tasks completed. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
filelock >=3.16 adds an at-fork audit that raises "os.fork is unsafe while filelock is changing descriptor ownership" when evaluate's code_eval forks to execute generated code (HumanEval/MBPP/LBPP). Pin below it so code execution tasks run. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Two independent fixes, both required for the HF
evaluate-based code tasks (HumanEval / MBPP / LBPP + theirdeuvariants) to run in a multi-job eval-hive fleet. Both are latent bugs that only surface under fork + concurrency, so single/serial runs mask them.1. Pin
filelock < 3.16(pixi.toml)filelock >= 3.16adds an at-fork audit that raiseswhen
code_evalforks to execute generated code. This kills every code task regardless of concurrency.2. Isolate
evaluate's metrics cache per batch (create_run.py)evaluatenames its compute-cache file only byexperiment_id:and
HF_METRICS_CACHEdefaults to$HF_HOME/metrics(usually shared storage). Concurrent batches —parallel_tasks > 1, and across jobs that shareHF_HOME— race on that single file: one process finishes andos.remove()s it, the next crashes withFileNotFoundError, failing the whole batch (up totask_batch_sizetasks) as collateral. The batch runner now sets a per-batch node-localHF_METRICS_CACHE.Verification
Hit both on a 31-checkpoint prelude fleet (30 nodes sharing one gpfs
HF_HOME). Symptoms: code tasks crashed with theos.forkerror (fix 1), then — after pinning filelock — with thedefault_experimentFileNotFoundError(fix 2); ~2 code-containing batches failed per job → ~15 missing tasks per checkpoint and no codepass@1. With both fixes, a 3-job canary showed 0 race errors and all code tasks landed, and the full fleet then completed 332/332 tasks on every checkpoint.🤖 Generated with Claude Code