fix: core evaluator/cache/utils correctness fixes#1378
Conversation
- cache.save_to_cache: accumulate serializable_obj per item (previously
mutated subitems but never appended, so it always pickled an empty list)
- response_cache: recursively fingerprint nested task groups so subtasks
get real fingerprints instead of falling back to empty strings
- evaluator:
- redact api_key/token/hf_token-style values from results.config
- clone padding Instances so [pad_source]*n no longer aliases one object
- auto-init a gloo process group and inject lm._rank/_world_size for
multi-rank launches whose backend never called init_process_group
- fix torchrun all_gather_into_tensor (1-D input tensor, world_size buffer)
- defensively skip docs with no requests in the postprocess loop
- utils:
- repo-root-anchored git commit/branch helpers with env fallbacks
(LMMS_EVAL_GIT_COMMIT/GITHUB_SHA/GITHUB_REF_NAME) and detached-HEAD handling
- build_eval_output_dir helper
- resolve relative dataset_kwargs.data_files to absolute paths for local
csv/json/parquet builders
- py3.13 re.split(maxsplit=) keyword fix
…te padding clones per slot
|
@kcz358 @pufanyi This batch of 12 PRs (#1378–#1389) upstreams fixes and features from our fork — all now ready for review. Every PR went through a full review pass today; findings were fixed on the branches and each PR body has a "Review pass (2026-07-06)" section summarizing what changed. A map to make this reviewable: Suggested merge order — plain numeric order (#1378 → #1389) avoids all conflicts. The actual constraints:
What's in the batch:
CI note — pre-existing, not from this batch: Ping me here or on the individual PRs with anything. |
Core evaluator / cache / utils correctness fixes
A cluster of standalone correctness fixes for the eval pipeline, response cache, and utils. No new dependencies; all changes are additive or in-place bug fixes.
lmms_eval/caching/cache.pysave_to_cacheaccumulated per-item results intoserializable_itemand appended toserializable_obj. Before, the loop mutatedsubitem.argumentsbut never appended anything, so the cache always pickled an empty list.--cache_requests(opt-in, default off) a dataset changed in place under an unchanged task config will reuse stale requests. That key design predates this PR — flagging it because the cache now actually works and the caveat becomes reachable.lmms_eval/caching/response_cache.py_collect_fingerprints), so subtasks get real config fingerprints instead of silently falling back to empty strings.lmms_eval/evaluator.pyresults["config"]before it is written out. Matching is suffix-based (*api_key/*_token/*_secret/*password, plus the exact-name set andkey=valueassignments insidemodel_argsstrings), soopenai_api_key=and friends don't slip through.[pad_source] * n, aliasing a singleInstanceso all padding requests shared oneresps/token_countslist. Now each padding slot is a distinct isolated clone (_clone_padding_requestinside the loop).distributed_executor_backend="torchrun", whenworld_size > 1andtorch.distributedis uninitialized, auto-init aglooprocess group so backends that never callinit_process_groupdon't crash evaluator collectives — guarded onMASTER_ADDR/MASTER_PORTbeing present (clear warning + skip otherwise, instead of raising). The defaultacceleratepath is untouched: the evaluator'sAccelerator()fallback creates its own state, so GPU collectives are never silently downgraded onto a pre-created gloo group.all_gather_into_tensornow uses a 1-D input tensor and aworld_size-sized buffer.requests[0].doc.lmms_eval/utils.pyget_git_commit_hash/get_git_branch_name: anchored at the repo root (works regardless of CWD), with env fallbacks (LMMS_EVAL_GIT_COMMIT/GIT_COMMIT/GITHUB_SHA,LMMS_EVAL_GIT_BRANCH/GIT_BRANCH/BRANCH_NAME/GITHUB_REF_NAME) and detached-HEAD handling.csv/json/parquet/text/pandas/arrow) now resolve relativedataset_kwargs.data_filespaths to absolute against the YAML dir; HF-hub dataset paths are left untouched.re.split(..., maxsplit=maxsplit)(positionalmaxsplitis deprecated in 3.13).Validation
py_compileclean on all four files; pre-commit black+isort clean;ruffintroduces no new findings.data_filesresolution, secret redaction (prefixed keys + string-form assignments), and padding-clone isolation (N distinct objects for N slots).Review pass (2026-07-06)
Self-review follow-up commit: gated the gloo auto-init to the torchrun path with the MASTER_ADDR/PORT guard (see above), moved the padding clone inside the loop so slots are truly isolated, switched redaction to suffix matching, and dropped an unused
build_eval_output_dirhelper that had no callers.