Skip to content

Conversation

@kesmeey
Copy link

@kesmeey kesmeey commented Nov 27, 2025

Motivation

💡 If this PR is a Cherry Pick, the PR title needs to follow the format by adding the [Cherry-Pick] label at the very beginning and appending the original PR ID at the end. For example, [Cherry-Pick][CI] Add check trigger and logic(#5191)

💡 如若此PR是Cherry Pick,PR标题需遵循格式,在最开始加上[Cherry-Pick]标签,以及最后面加上原PR ID,例如[Cherry-Pick][CI] Add check trigger and logic(#5191)

Modifications

Usage or Command

Accuracy Tests

Checklist

  • Add at least a tag in the PR title.
    • Tag list: [[FDConfig],[APIServer],[Engine], [Scheduler], [PD Disaggregation], [Executor], [Graph Optimization], [Speculative Decoding], [RL], [Models], [Quantization], [Loader], [OP], [KVCache], [DataProcessor], [BugFix], [Docs], [CI], [Optimization], [Feature], [Benchmark], [Others], [XPU], [HPU], [GCU], [DCU], [Iluvatar], [Metax]]
    • You can add new tags based on the PR content, but the semantics must be clear.
  • Format your code, run pre-commit before commit.
  • Add unit tests. Please write the reason in this PR if no unit tests.
  • Provide accuracy results.
  • 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.

Copilot AI review requested due to automatic review settings November 27, 2025 03:48
@paddle-bot
Copy link

paddle-bot bot commented Nov 27, 2025

Thanks for your contribution!

@paddle-bot paddle-bot bot added the contributor External developers label Nov 27, 2025
Copilot finished reviewing on behalf of kesmeey November 27, 2025 03:50
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

该 PR 为 Hackathon 9th Sprint Example NO 22 任务补充了 fastdeploy/input/ernie4_5_vl_processor/ernie4_5_vl_processor.py 模块的单元测试。主要目的是提高代码测试覆盖率,针对多个内部方法添加了全面的测试用例。

主要变更:

  • 新增了 _parse_processor_kwargs_parse_limits_check_mm_limits_apply_default_parameters 方法的单元测试
  • 测试覆盖了正常场景、异常场景和边界条件
  • 删除了原有的部分重复测试代码
Comments suppressed due to low confidence (5)

tests/input/test_ernie4_5_vl_processor.py:151

  • test_parse_processor_kwargs_valid 测试中手动绑定了方法 _parse_processor_kwargs,但在 test_parse_processor_kwargs_invalid_type 中没有进行同样的绑定。为了保持一致性,建议在 test_parse_processor_kwargs_invalid_type 中也手动绑定该方法,或者在两个测试中都使用类方法直接调用的方式。

建议修改为:

processor._parse_processor_kwargs = Ernie4_5_VLProcessor._parse_processor_kwargs.__get__(
    processor, Ernie4_5_VLProcessor
)
result = processor._parse_processor_kwargs(invalid_kwargs)

tests/input/test_ernie4_5_vl_processor.py:164

  • test_parse_processor_kwargs_not_dict 测试中没有绑定方法 _parse_processor_kwargs,但直接调用了 Ernie4_5_VLProcessor._parse_processor_kwargs(processor, ...)。为了保持一致性,建议使用与 test_parse_processor_kwargs_valid 相同的方法绑定方式。

建议修改为:

processor._parse_processor_kwargs = Ernie4_5_VLProcessor._parse_processor_kwargs.__get__(
    processor, Ernie4_5_VLProcessor
)
result = processor._parse_processor_kwargs("not a dict")

tests/input/test_ernie4_5_vl_processor.py:201

  • test_parse_limits_invalid_type 测试中没有绑定方法 _parse_limits,但直接调用了 Ernie4_5_VLProcessor._parse_limits(processor, ...)。为了保持一致性,建议使用与 test_parse_limits_valid 相同的方法绑定方式。

建议修改为:

processor._parse_limits = Ernie4_5_VLProcessor._parse_limits.__get__(processor, Ernie4_5_VLProcessor)
result = processor._parse_limits("not a dict")

tests/input/test_ernie4_5_vl_processor.py:269

  • test_apply_default_parameters_with_dict 测试中,generation_config 只设置了 top_ptemperature 属性,但根据源代码(第111-115行),_apply_default_parameters 方法还会设置其他参数(repetition_penaltyfrequency_penaltypresence_penalty)。为了使测试更加完整和准确,建议也为这些参数设置 mock 值或验证它们使用的默认值。

建议添加:

processor.generation_config.repetition_penalty = 1.0
processor.generation_config.frequency_penalty = 0.0
processor.generation_config.presence_penalty = 0.0

tests/input/test_ernie4_5_vl_processor.py:294

  • test_apply_default_parameters_with_object 测试中,generation_config 只设置了 top_p 属性,但根据源代码(第111-115行),_apply_default_parameters 方法会设置多个参数。测试只验证了 top_p,没有验证其他参数(如 temperaturerepetition_penalty 等)。为了提高测试覆盖率,建议添加对所有参数的验证。

建议修改 MockRequest 类:

class MockRequest:
    def __init__(self):
        self.top_p = None
        self.temperature = None
        self.repetition_penalty = None
        self.frequency_penalty = None
        self.presence_penalty = None

并添加相应的 mock 配置和断言。


You can also share your feedback on Copilot code review for a chance to win a $100 gift card. Take the survey.

@codecov-commenter
Copy link

Codecov Report

✅ All modified and coverable lines are covered by tests.
⚠️ Please upload report for BASE (develop@a12eaf9). Learn more about missing BASE report.

Additional details and impacted files
@@            Coverage Diff             @@
##             develop    #5263   +/-   ##
==========================================
  Coverage           ?   61.51%           
==========================================
  Files              ?      317           
  Lines              ?    38812           
  Branches           ?     5849           
==========================================
  Hits               ?    23876           
  Misses             ?    13049           
  Partials           ?     1887           
Flag Coverage Δ
GPU 61.51% <ø> (?)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@kesmeey kesmeey force-pushed the test/no22-ernie4_5_vl_processor branch from 6f96ca9 to 666f81c Compare November 27, 2025 11:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants