FastDeploy icon indicating copy to clipboard operation
FastDeploy copied to clipboard

[CI] 【Hackathon 9th Sprint No.20】NO.20 功能模块单测补充

Open xunyoyo opened this issue 1 month ago • 2 comments

This commit adds unit tests for the sampler helpers, covering guided decoding and speculative flows. It includes various test cases to ensure the correct functionality of the sampling methods and processors.

Motivation

NO.20 功能模块 fastdeploy/model_executor/layers/sample/sampler.py 单测补充

Modifications

add tests/model_executor/test_sampler.py

Usage or Command

tests/model_executor/test_sampler.py:

python -m coverage run -m unittest tests.model_executor.test_sampler \
&& python -m coverage report -m --include='fastdeploy/model_executor/sample/sampler.py'

Accuracy Tests

tests/model_executor/test_sampler.py:

Name                                                 Stmts   Miss  Cover   Missing
----------------------------------------------------------------------------------
fastdeploy/model_executor/layers/sample/sampler.py     390     69    82%   94-96, 98-100, 107, 112-113, 124, 127, 136, 143, 150,
 153, 158, 170, 186, 193, 225, 241, 245, 249, 253, 356, 380, 421, 447-450, 466, 502-511, 518-533, 535, 575-576, 687-688, 717, 75
3-765, 772-791, 793, 833-834, 854-855
----------------------------------------------------------------------------------
TOTAL                                                  390     69    82%

Checklist

  • [x] 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.
  • [x] Format your code, run pre-commit before commit.
  • [x] Add unit tests. Please write the reason in this PR if no unit tests.
  • [x] Provide accuracy results.
  • [x] 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.

xunyoyo avatar Nov 15 '25 11:11 xunyoyo

Thanks for your contribution!

paddle-bot[bot] avatar Nov 15 '25 11:11 paddle-bot[bot]

Codecov Report

:white_check_mark: All modified and coverable lines are covered by tests. :warning: Please upload report for BASE (develop@21fa2ba). Learn more about missing BASE report.

Additional details and impacted files
@@            Coverage Diff             @@
##             develop    #5065   +/-   ##
==========================================
  Coverage           ?   63.98%           
==========================================
  Files              ?      329           
  Lines              ?    41716           
  Branches           ?     6378           
==========================================
  Hits               ?    26692           
  Misses             ?    13009           
  Partials           ?     2015           
Flag Coverage Δ
GPU 63.98% <ø> (?)

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

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

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

codecov-commenter avatar Dec 15 '25 13:12 codecov-commenter