Skip to content

ImageReference: make image laziness a declared contract #395

Open

Description

@jason718

cc @jason718 — follow-up from the multimodal eval stack (#278), requested on #324.

LMRequest.images accepts several shapes — a PIL image, a path, a zero-arg callable, or a callable returning a list — and olmo_eval.common.images.resolve_images normalizes them in the provider. It works, and it keeps pixels out of the parent process, but the contract is conventional rather than typed: a task can attach an unpicklable closure and only fail once the multiprocessing queue tries to pickle it.

Proposal: a small ImageReference ABC (PathImage, HfDatasetImage, ImageList, ...) with a resolve() method, so the accepted shapes are enumerable and picklability is structural. Note the related hazard for whoever picks this up: runners/io/builders.py spreads instance.metadata into the predictions doc and writers.py json.dumps it with no fallback, so the benchmarks that store lazy loaders in metadata crash the predictions/requests writers (Object of type partial is not JSON serializable) — --no-save-requests sidesteps it today. A typed reference with a JSON form would fix both.

Tyler's review item #6 on #278.

Activity

  1. jason718 commented on Sep 24, 2026

    @jason718
    ContributorAuthor

    #324 fixes the concrete writer hazard described above, and it is worse on current main than this issue says: the runner no longer crashes. write_requests_jsonl raises on the first record, the error is swallowed, and the run reports Success with an empty requests.jsonl. Reproduced with olmo-eval run -m mock -t muir_bench -o limit=3 (0 lines written; 3 with the fix).

    The fix (fa84df7 on #324) gives both JSONL writers a json.dumps fallback that writes non-JSON values as a type placeholder ("images": "<partial>"). That is enough to stop losing records, but it is not the ImageReference design, so this stays open for the typed reference with a real JSON form.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions