pp-doclayout: skip corrupt images instead of crashing the run
davanstrien+1: Claude Opus 4.7 (1M context)HF Staff
15cd760
Previously, a single corrupt image (UnidentifiedImageError or OSError)
in the source bucket or dataset would terminate the entire run via an
unhandled exception in the gen() iterator. On a 5000-image run, hitting
a truncated/unreadable file at sample 2400 wasted ~1 hour of GPU time.
Now both iter_bucket_images() and iter_dataset_images() catch
UnidentifiedImageError and OSError per image, log a WARNING with the
path, and continue. A summary "Skipped N unreadable image(s)" is logged
when the iterator exhausts. Run completes with whatever images were
readable.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Add pp-doclayout.py: PP-DocLayout-L layout detection with bucket support