fix(image): keep longest-edge resize dimensions nonzero - #761
JesusMan0529 wants to merge 2 commits into
Conversation
|
Navigate logical layers of code changes, visualize relationships, and explore their blast radius. No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configuration
📒 Files selected for processing (2)
🚧 Files skipped from review as they are similar to previous changes (2)
Included review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 6 remain after this review. 📝 WalkthroughWalkthrough
Priority: ➖ Normal Estimated code review effort: 2 (Simple) | ~8 minutes Change: Bug fix Merge Risk: ⚪ Minimal · up to The thin-image resize fix has no identified merge-blocking issue. Normal checks remain appropriate before merging. 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
Reproduced the crash in both orientations ( Local validation: 27 related tests passed, both pinned pre-commit hooks passed, repository-wide Ruff lint and the CI mypy/pyright commands passed. The root formatting check reports three unchanged files; full model-download/inference tests were not completed locally. |
|
Added concise docstrings to |
|
Hope it could be merged 😊 |
A
4096 x 1or1 x 4096image resized to a longest edge of 2048 currently truncates its shorter edge to zero. Pillow raisesValueError: height and width must be > 0, including when the image goes through ColModernVBERT's Idefics3 preprocessing.Clamp the final resize dimensions to at least one pixel, matching Idefics3's reference behavior. Tests cover both orientations, existing even rounding and ordinary images, plus the real
Composepipeline with image splitting, rescaling and normalization.Validation:
pytest tests/test_image_transform.py tests/test_common.py tests/test_postprocess.py::test_empty_multivectors_raise_value_error -q: 27 passed.pyright tests/type_stub.py, andgit diff --check: passed.ruff format --check .reports three unchanged files (experiments/attention_export.py,experiments/try_attention_export.py,tests/test_postprocess.py); both modified files pass formatting. The full model-download/inference suite was not completed locally.All submissions: