Skip to content

fix: report no data instead of crashing when a run has no score files - #201

Open
Borislo83 wants to merge 2 commits into
EleutherAI:mainfrom
Borislo83:fix/log-results-no-score-files
Open

Borislo83 wants to merge 2 commits into
EleutherAI:mainfrom
Borislo83:fix/log-results-no-score-files

Conversation

@Borislo83

Copy link
Copy Markdown

A run that scores no latents ends with a traceback instead of the "No data found" message:

  File "delphi/log/result_analysis.py", line 219, in load_data
    return pd.concat(latent_dfs, ignore_index=True), counts
ValueError: No objects to concatenate

This is reachable with the defaults. process_cache creates each scores/<scorer> folder before scoring, the constructor skips latents with fewer than min_examples (default 200) examples, and verbose defaults to True, so log_results runs at the end. A small cache, or a narrow max_latents over sparse latents, leaves the scorer folders empty, and load_data calls pd.concat on an empty list. The same happens when the folders only hold score files for hookpoints that were not requested.

log_results already handles an empty frame (if latent_df.empty: print("No data found")), but load_data could never return one. test_logging_empty_scores_returns_before_plotting covers that branch with load_data replaced by a stub, so the real path was not exercised.

load_data now returns an empty frame when it finds no score files.

I found this while reading result_analysis.py and did not find an existing issue or PR for it.

Tests

  • Added test_load_data_without_score_files_returns_empty_frame and test_logging_without_score_files_reports_no_data. Both use a real, empty scores/detection folder and fail on main with the ValueError above.
  • pytest tests/test_log/test_result_analysis.py: 9 passed. ruff check . and black --check are clean.
  • I did not run the full test suite locally (I did not install vLLM and the other heavy dependencies), so I am relying on CI for the rest.

Not changed: if scores/ itself does not exist, scores_path.iterdir() still raises FileNotFoundError. That needs an empty scorers list and is the same on main.

@CLAassistant

Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants