Repository navigation
Conversation
This branch has not been deployed
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.
Fixes #395.
Description
Replaces untyped
functools.partial/ closure lazy image loaders with an explicitImageReferencecontract (resolve()andto_json()) so deferred image loading stays picklable, inspectable, and JSON-serializable across request construction, worker queues, resume hashing, CLI inspection, and JSONL output writers.What changed
src/olmo_eval/common/images.py,src/olmo_eval/common/types/base.py):ImageReference(ABC)withresolve()andto_json(), typedLMRequest.imageswithImageReference, and added frozen, slotted, picklable implementations:PathImage,HfDatasetImage,HfDatasetImageList,ImageList, andCappedImageList(which slicesHfDatasetImageListbefore decoding instead of materializing excess images).resolve_imageandresolve_imagesto resolveImageReferenceentries cleanly while preserving compatibility for raw paths, PIL images, and legacy callables.encode_image_entryfor structured JSON encoding.src/olmo_eval/evals/vision/):lazy_hf_image,lazy_hf_image_list, andcapped_image_list(evals/vision/data/images.py),VisionTask._attach_images(evals/vision/tasks/base.py),MmmuProTask._attach_images(evals/vision/benchmarks/mmmu_pro.py),TsvImageReference(evals/vision/benchmarks/cc_ocr.py), andPdfPageImage(evals/vision/benchmarks/olmocr_bench.py) to construct typedImageReferenceobjects instead offunctools.partialcallables.src/olmo_eval/runners/io/writers.py&src/olmo_eval/inference/providers/replay.py: replaced_lazy_loader_placeholderwith_request_json_defaultand_prediction_json_default, serializingImageReferenceviato_json()instead of emitting"<partial>"while retaining legacy callable placeholders inwrite_requests_jsonland strict rejection of non-JSON types inwrite_predictions_jsonl.src/olmo_eval/runners/asynq/progress.py: handledImageReferenceviato_json()in_hash_defaultprior tois_dataclass(avoidingdataclasses.asdict()traversal into HFDatasetobjects) and skippedImageReferencevalues in_metadata_changes.src/olmo_eval/cli/task/__init__.py&src/olmo_eval/common/inspection.py: serializedImageReferenceandLMRequest.imagescleanly intask inspect --jsonandinspect_request/format_value/_format_simple_value.tests/core/test_images.py,tests/evals/vision/test_task_contracts.py,tests/runners/io/test_writers.py):PathImage,HfDatasetImage,HfDatasetImageList,CappedImageListearly truncation,ImageList/MmmuProTask._attach_images,TsvImageReference,PdfPageImage, pickle roundtrips, JSONL serialization,request_hash,_metadata_changes, and inspection formatting.Affected results
None. Task specifications, prompts, scorers, and
tests/evals/tasks/test_task_hashes.pyhashes are unchanged;ImageReferenceresolves to the same PIL images as the previous lazy loaders while adding structured JSON metadata.Type of Change
Validation
Executed on Windows (
win32, Python 3.13.1, commit26c39af3a81b39812ed6ba5d4bfc8609e9494956) usinguv run --frozen --no-sync --no-group vllm --extra clients --extra litellm --extra agents:uv run --frozen --no-sync --no-group vllm --extra clients --extra litellm --extra agents ruff check src/ tests/andruff format --check src/ tests/— passed (All checks passed!,757 files already formatted)uv run --frozen --no-sync --no-group vllm --extra clients --extra litellm --extra agents ty check --python-platform linux src/— passed (All checks passed!)./scripts/check_file_sizes.sh— passed (All 1164 tracked files are within 1.00 MB.)uv build— built source distribution and wheel cleanlypytest tests/core/test_images.py -o addopts="" -v -W error::ResourceWarning—6 passedtests/core/test_images.py,tests/evals/vision/,tests/runners/io/,tests/providers/test_replay_provider.py,tests/providers/test_huggingface_provider.py,tests/providers/test_sglang_provider.py,tests/core/harness/test_harness.py,tests/evals/tasks/test_task_hashes.py) —463 passed, 4 skippedtests/common,tests/core,tests/evals,tests/harness,tests/inference,tests/providers,tests/runners,tests/cli/test_{arg_round_trip,dotlist_overrides,harness_overrides,output_dir_default,utils}.py,tests/cli/beaker/test_{example_configs,sglang_install}.py,tests/test_package.py,tests/test_readme.py,tests/test_runner.py, excluding the Windows-incompatible POSIX/pexpect.spawn/os.O_DIRECTORY/Unix-PATH files listed under Remaining work) —4336 passed, 23 skipped;pytest tests/cli/test_results_upload.py -k "not sigterm"—9 passed, 5 deselectedtests/core/test_images.py,tests/runners/io/test_writers.py)Remaining work
uv run pytest tests/ --ignore=tests/integration -v) and Docker integration tests (tests/integration/) need to run on GitHub Actions Linux runners; on Windows, POSIX/Linux-specific test modules (test_http_command.py,test_http_session.py,test_owned_docker_deployment.py,test_sandbox_executor.py,test_terminal_bench_external.py,test_livecodebench.py,test_ruler_plus.py,test_vllm_server_startup.py,test_resume.py,test_results_upload.py[sigterm],tests/data/,tests/upload/,tests/scripts/,tests/cli/beaker/test_{build_image_script,launch,resume_access,upload_wiring}.py) were excluded or skipped.