Fix background_color handling across DeepSeek-VL and Janus image processors (#49767)
* Fix background_color handling across DeepSeek-VL and Janus image processors
* Address review: drop background_color override, derive it from image_mean only
@reviewer pointed out the reference VLMImageProcessor never accepts background_color
independently -- it always computes int(x*255) over image_mean. Checked: the real
deepseek-vl-7b-chat checkpoint's saved background_color (122, 116, 104) is exactly
int(x*255) over its own (CLIP) image_mean, i.e. a derived snapshot, not an
independently meaningful value -- so preserving an explicit/saved background_color
was unnecessary scope beyond the actual bug (one backend reading kwargs.get("image_mean")
instead of self.image_mean) and diverges from upstream's contract.
Dropped the override across all 6 __init__s; the two single-resolution PIL backends
already read self.image_mean correctly pre-fix and revert to their original form
entirely. image_processing_deepseek_vl.py / image_processing_pil_deepseek_vl.py are
generated from modular_deepseek_vl.py, which inherits __init__ from Janus without
overriding it -- fixed Janus's two files directly and regenerated DeepSeek-VL's via
`utils/checkers.py modular_conversion --fix` instead of hand-editing the generated
files (the original commit hand-edited them directly; this corrects that too).
Trimmed test_background_color to drop the override-specific assertions; kept the
default-value check (catches the 127-vs-122 mismatch directly) and the save/load
round-trip check (catches it surviving a reload).
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
---------
Co-authored-by: Claude Sonnet 5 <noreply@anthropic.com>