[Cherry-Pick][Loader][BugFix] Fix some parameters place on CPU in PaddleOCR-VL (#5413)#5414
Conversation
|
Thanks for your contribution! |
There was a problem hiding this comment.
Pull request overview
This cherry-pick PR from #5413 fixes parameter placement issues on CPU in PaddleOCR-VL models by ensuring proper device handling during weight loading. The changes replace direct param.copy_ calls with the h2d_copy utility function, which handles cross-device tensor copying correctly for both GPU and CPU platforms.
Key changes:
- Replace
param.copy_withh2d_copyfor proper device-aware tensor copying - Add parameter initialization checks before weight loading
- Add missing
h2d_copyimport in projector.py
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| fastdeploy/model_executor/models/paddleocr_vl/siglip.py | Updated three weight_loader methods (out_proj_weight_loader and SiglipMLP.weight_loader) to use h2d_copy and add initialization checks |
| fastdeploy/model_executor/models/paddleocr_vl/projector.py | Added h2d_copy import and updated weight_loader method in Projector class with initialization check and h2d_copy usage |
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## release/2.4 #5414 +/- ##
==============================================
Coverage ? 59.09%
==============================================
Files ? 326
Lines ? 40336
Branches ? 6117
==============================================
Hits ? 23838
Misses ? 14659
Partials ? 1839
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
7926add
into
PaddlePaddle:release/2.4
Motivation
cherry-pick of #5413
Modifications
see #5413
Usage or Command
see #5413
Accuracy Tests
无
Checklist
[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]]pre-commitbefore commit.releasebranch, make sure the PR has been submitted to thedevelopbranch, then cherry-pick it to thereleasebranch with the[Cherry-Pick]PR tag.