Fix VaeImageProcessorLDM3D silently discarding its own constructor arguments - #14662
Open
afonsojanu wants to merge 1 commit into
Open
Fix VaeImageProcessorLDM3D silently discarding its own constructor arguments#14662afonsojanu wants to merge 1 commit into
afonsojanu wants to merge 1 commit into
Conversation
VaeImageProcessorLDM3D.__init__ called super().__init__() with no arguments, even though it accepts do_resize, vae_scale_factor, resample, and do_normalize. Since VaeImageProcessor's own __init__ is also wrapped by @register_to_config, that empty call re-registered the base class's defaults for those same four keys right on top of the values LDM3D had just registered a moment earlier, so anything other than the defaults passed to LDM3D silently got thrown away. Forward the received arguments the same way IPAdapterMaskProcessor and PixArtImageProcessor already do for their own super().__init__() call.
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 #14429
VaeImageProcessorLDM3D's constructor accepts do_resize, vae_scale_factor, resample, and do_normalize, but the body just calls super().init() with nothing. VaeImageProcessor's own init is decorated with @register_to_config too, so that empty call re-runs its wrapper with the base class's own defaults for those exact four names, and register_to_config merges new values over the existing dict rather than skipping keys already set. The net effect: whatever LDM3D registered a line earlier gets clobbered right back to VaeImageProcessor's defaults before the constructor even returns.
Two other VaeImageProcessor subclasses in this same file, IPAdapterMaskProcessor and PixArtImageProcessor, already forward their arguments explicitly to super().init(...), so this brings LDM3D in line with that.
Added a test alongside the rest of tests/others/test_image_processor.py that constructs the processor with all four non-default values and checks they survive, plus a defaults case for the other direction. Reverted just the source change locally to confirm the new test fails with the exact clobbering behavior described above, then restored it. Ran the full image processor and config test suites, 22 passed. ruff check and ruff format both clean on the touched files.