Skip to content

Handle recoverable truncated image payloads - #1554

Open
rajantripathi wants to merge 1 commit into
open-compass:mainfrom
rajantripathi:fix-truncated-image-loading
Open

Handle recoverable truncated image payloads#1554
rajantripathi wants to merge 1 commit into
open-compass:mainfrom
rajantripathi:fix-truncated-image-loading

Conversation

@rajantripathi

@rajantripathi rajantripathi commented May 25, 2026

Copy link
Copy Markdown

Summary

  • retry recoverable truncated PNG/JPEG payloads in the central base64 image decoder
  • keep strict Pillow decoding as the default path
  • limit Pillow's process-wide truncated-image flag to the recovery attempt and restore its previous value immediately
  • add a regression test covering base64 TSV image decoding and flag restoration

Why

Some benchmark TSVs contain recoverable truncated image payloads. A single recoverable image should not cause an entire evaluation combination to fail, but permissive decoding should also not remain enabled globally.

Fixes #1400.

Validation

  • rebased onto current upstream main
  • python3 -m py_compile vlmeval/smp/vlm.py tests/test_smp_vlm.py: passed
  • direct execution of the regression function: passed
  • verified that the recovered image is loadable and retains its expected dimensions
  • verified that ImageFile.LOAD_TRUNCATED_IMAGES is restored after recovery
  • git diff --check origin/main...HEAD: passed

Full pytest collection is not available in the local minimal environment because pytest and the repository's optional benchmark dependency stack are not installed.

@rajantripathi
rajantripathi force-pushed the fix-truncated-image-loading branch from f892f39 to 8ad08dd Compare July 24, 2026 13:26
@rajantripathi
rajantripathi force-pushed the fix-truncated-image-loading branch from 8ad08dd to 178bf28 Compare August 19, 2026 10:44
@rajantripathi

Copy link
Copy Markdown
Author

Rebased this PR onto the current upstream main (e8e78f0) with no conflicts. The updated head is 178bf28.

Current validation:

  • python3 -m py_compile vlmeval/smp/vlm.py tests/test_smp_vlm.pypassed
  • Executed the regression test function directly — truncated-image recovery smoke test passed
  • git diff --check origin/main...HEADpassed
  • PR remains mergeable and contains one commit over current main.

When convenient, could a maintainer review this fix for #1400? I am happy to adjust the implementation or test placement to match project preferences.

@rajantripathi
rajantripathi force-pushed the fix-truncated-image-loading branch from 178bf28 to a873252 Compare September 2, 2026 15:01
@rajantripathi

Copy link
Copy Markdown
Author

Rebased onto the latest upstream main and tightened the implementation after another review. Strict Pillow decoding remains the default; only errors explicitly identified as truncated-image failures trigger a permissive retry, and the global Pillow flag is restored in a finally block. The regression test now verifies both successful recovery and flag restoration. Current head: a873252.

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.

[MMSIBench] OSError: image file is truncated

1 participant