Skip to content

vesuvius.predict: report the real error when inference fails (refs #1360) - #1827

Draft
ge-al wants to merge 1 commit into
ScrollPrize:mainfrom
ge-al:fix/predict-report-infer-failure
Draft

ge-al wants to merge 1 commit into
ScrollPrize:mainfrom
ge-al:fix/predict-report-infer-failure

Conversation

@ge-al

@ge-al ge-al commented Sep 17, 2026

Copy link
Copy Markdown
Contributor

In one sentence: When vesuvius.predict fails inside inference, the CLI now says so and names the error, instead of reporting cannot unpack non-iterable NoneType object.

One real example: Starting with the public scrollprize/surface_recto_verso checkpoint laid out as downloaded from Hugging Face (checkpoint_final.pth at the model root, no fold_0/), I ran vesuvius.predict --model_path … --input_dir s3://vesuvius-challenge-open-data/PHerc1447/volumes/20250521151220-8.640um-1.2m-116keV-masked.zarr --input_anon --bbox 4900:5156,3600:3824,4100:4356 --device cpu, and the run ended with a message about the missing checkpoint instead of an unpacking error.

Before:

An error occurred during inference: Checkpoint file not found: .../surface_recto_verso/fold_0/checkpoint_final.pth
Traceback (most recent call last):
  File ".../vesuvius/models/run/inference.py", line 1396, in main
    logits_path, coords_path = inferer.infer()
    ^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: cannot unpack non-iterable NoneType object

--- Inference Failed ---
Error: cannot unpack non-iterable NoneType object

The exit code is already 1 on main (cause 3 of #1360 is fixed), but the headline error is the wrong one: Inferer.infer() catches its own exception, prints it, and returns None, and main() unpacks that None.

After this PR:

An error occurred during inference: Checkpoint file not found: .../surface_recto_verso/fold_0/checkpoint_final.pth
(traceback)

--- Inference Failed ---
Inference raised the error shown above and wrote no output.
exit code 1

Proof: the before block is the verbatim tail of my run on 23adee0; the after block is the same command on this branch. Test tests/models/run/test_inference_main_failure.py drives main() with an Inferer whose infer() fails the way the real one does and asserts exit 1, the original error in the output, and no "cannot unpack". While here, measured on the same data that #1360's causes 1 and 2 are already fixed on main under zarr 3.2.1: with the checkpoint in fold_0/, vesuvius.predict creates logits_part_0.zarr and coordinates_part_0.zarr and runs (Created zarr array … shape (64, 4, 256, 224, 256)).

Why / where this is useful: anyone driving vesuvius.predict from a script or a sweep gets the actual cause in the last lines of the log, which is where they look first.

  • I personally verified that the example and proof above were produced by this PR on the stated data.

Details

Refs #1360 (causes 1–2 measured fixed on main; cause 3's exit code was already 1; this makes the message match). Measured at 23adee0, macOS, Python 3.14, zarr 3.2.1; main() still unpacks the None on current main, and the branch is rebased onto 2dcfaf6 (tests/models/run: 57 passed). Opened as a draft only because of the three-open-PR limit for outside contributors (#1743); it is ready for review.

Written with Claude Code as a coding assistant, directed and reviewed by me.

Inferer.infer() catches its own exception, prints the traceback and
returns None; main() then unpacked that None and announced
'cannot unpack non-iterable NoneType object' as the failure. Exit code
was already 1 (ScrollPrize#1360 cause 3), but the message pointed at the wrong
thing. Treat a None result as the failure it is and say so.

Refs ScrollPrize#1360

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
@vercel

vercel Bot commented Sep 17, 2026

Copy link
Copy Markdown

@ge-al is attempting to deploy a commit to the scroll Team on Vercel.

A member of the Team first needs to authorize 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.

1 participant