Skip to content

Fix LDM3D NumPy batch preprocessing - #14437

Open
rathodkunj2005 wants to merge 1 commit into
huggingface:mainfrom
rathodkunj2005:fix-ldm3d-image-processor-inputs-20260810
Open

Fix LDM3D NumPy batch preprocessing#14437
rathodkunj2005 wants to merge 1 commit into
huggingface:mainfrom
rathodkunj2005:fix-ldm3d-image-processor-inputs-20260810

Conversation

@rathodkunj2005

Copy link
Copy Markdown

What does this PR do?

Fixes #14428.

VaeImageProcessorLDM3D.preprocess supports NumPy RGB/depth batches, but the depth branch was choosing between concatenate and stack by checking the already-processed RGB tensor instead of the original depth input. That made valid batched depth arrays become 5D and fail in numpy_to_pt with ValueError: axes don't match array.

This PR:

  • forwards the LDM3D image processor init arguments to VaeImageProcessor.__init__, matching the documented/configured behavior;
  • checks depth[0].ndim when batching NumPy depth inputs;
  • adds regression coverage for LDM3D config propagation and batched NumPy RGB/depth preprocessing.

Verification:

$ python -m pytest tests/others/test_image_processor.py -k 'ldm3d' -q
..                                                                       [100%]
2 passed, 10 deselected in 0.07s

$ python -m pytest tests/others/test_image_processor.py -q
............                                                             [100%]
12 passed, 2 warnings in 0.01s

$ python -m ruff check src/diffusers/image_processor.py tests/others/test_image_processor.py
All checks passed!

AI disclosure / self-review notes:

  • I used an AI agent to help identify, implement, and verify this focused fix, and reviewed the final diff before submission.
  • Blocking issues found in self-review: none.
  • Non-blocking issues found in self-review: none.
  • Dead-code advisory: none; the changed branches are exercised by the added tests.

Before submitting

  • Did you use an AI agent (Claude Code, Codex, Cursor, etc.) to help with this PR? If so:
    • Did you read the Coding with AI agents guide?
    • Did you run the self-review skill on the diff?
    • Did you share the final self-review notes in the PR description or a comment?
  • Did you read the contributor guideline?
  • Did you read our philosophy doc? (important for complex PRs)
  • Was this discussed/approved via a GitHub issue or the forum? Please add a link to it if that's the case.
  • Did you make sure to update the documentation with your changes? Not needed; this fixes documented behavior.
  • Did you write any new necessary tests?
  • Are you the author (or part of the team) of the model/pipeline (only applicable for model/pipeline related PRs)?

@github-actions github-actions Bot added tests size/S PR with diff < 50 LOC fixes-issue labels Aug 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

fixes-issue size/S PR with diff < 50 LOC tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

VaeImageProcessorLDM3D.preprocess fails for batched NumPy RGB/depth inputs

1 participant