Skip to content

[Optimization][DataProcessor] Refactor duplicated validation logic in VL processors and serving classes#6380

Draft
Copilot wants to merge 4 commits intodevelopfrom
copilot/refactor-duplicated-code-again
Draft

[Optimization][DataProcessor] Refactor duplicated validation logic in VL processors and serving classes#6380
Copilot wants to merge 4 commits intodevelopfrom
copilot/refactor-duplicated-code-again

Conversation

Copy link
Contributor

Copilot AI commented Feb 6, 2026

Motivation

Consolidate ~200 lines of duplicated validation logic across 8 VL processor implementations and multiple serving classes. Single point of maintenance for common validation patterns.

Modifications

Multimodal validation consolidation:

  • Extracted check_mm_limits() utility in fastdeploy/input/utils.py
  • Supports both in (list membership) and eq (equality) type checking modes
  • Added input validation for type_check_mode parameter
  • Applied across all VL processors (qwen, qwen3, ernie4.5, paddleocr) in v0 and v1

Serving master check consolidation:

  • Created MasterCheckMixin in fastdeploy/entrypoints/openai/utils.py
  • Applied to OpenAIServingChat and OpenAIServingCompletion
  • Left serving_engine and serving_models unchanged (different implementation patterns)

Impact:

  • 12 files modified: +98 lines, -175 lines (net -77)
  • Maintains backward compatibility
  • Existing test interfaces unchanged

Usage or Command

No API changes. Refactoring maintains existing behavior.

Accuracy Tests

Not applicable - pure refactoring with no functional changes.

Checklist

  • Add at least a tag in the PR title.
  • Format your code, run pre-commit before commit.
  • Add unit tests. Reason: Existing unit tests cover the refactored methods; test interfaces remain unchanged.
  • Provide accuracy results. Reason: No functional changes to model outputs.
  • If the current PR is submitting to the release branch, make sure the PR has been submitted to the develop branch, then cherry-pick it to the release branch with the [Cherry-Pick] PR tag.
Original prompt

Find and refactor duplicated code.


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

@CLAassistant
Copy link

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

Copilot AI and others added 3 commits February 6, 2026 08:26
…ts utility

Co-authored-by: Jiang-Jia-Jun <163579578+Jiang-Jia-Jun@users.noreply.github.com>
…etion

Co-authored-by: Jiang-Jia-Jun <163579578+Jiang-Jia-Jun@users.noreply.github.com>
…ove docstring

Co-authored-by: Jiang-Jia-Jun <163579578+Jiang-Jia-Jun@users.noreply.github.com>
Copilot AI changed the title [WIP] Refactor duplicated code for improved maintainability [Optimization][DataProcessor] Refactor duplicated validation logic in VL processors and serving classes Feb 6, 2026
Copilot AI requested a review from Jiang-Jia-Jun February 6, 2026 08:32
@paddle-bot
Copy link

paddle-bot bot commented Feb 6, 2026

Thanks for your contribution!

@paddle-bot paddle-bot bot added the contributor External developers label Feb 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

contributor External developers

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants