[Compat] Expose torch proxy APIs as public API
PR Category
User Experience
PR Types
New features
Description
将 torch proxy 系列 API 暴露为公开 API:
paddle.compat.enable_torch_proxypaddle.compat.disable_torch_proxypaddle.compat.extend_torch_proxy_blocked_modulespaddle.compat.use_torch_proxy_guard
下游使用情况:
- PaddlePaddle/FastDeploy#5211 即将通过 torch proxy 方式使用
triton,后续flashinfer等库同样会使用该方式 - PaddleFormers 同样会通过该方式来使用
torchcodec
后续所有兼容性方案走通的算子库/Kernel DSL library 都会通过以下方式来运行:
import paddle
paddle.compat.enable_torch_proxy(scope={"paddle_compatible_library_name"})
import paddle_compatible_library_name
这里 paddle_compatible_library_name 可以是 triton、tilelang、flashinfer、flash_mla、deep_gemm、deep_ep 等通过兼容性方式跑通的生态库,也比较推荐类似 fastdeploy 在 __init__.py 中开启,即
# fastdepoly/__init__.py
import paddle
paddle.compat.enable_torch_proxy(
scope={
"triton",
"flashinfer",
"deep_gemm",
# TODO: add other libraries
}
)
# 后续可以按照原生库的方式来使用 flashinfer 等库
细节可参考 跨生态自定义算子接入
你的PR提交成功,感谢你对开源项目的贡献! 请关注后续CI自动化测试结果,详情请参考Paddle-CI手册。 Your PR has been submitted. Thanks for your contribution! Please wait for the result of CI firstly. See Paddle CI Manual for details.
Codecov Report
:x: Patch coverage is 80.00000% with 2 lines in your changes missing coverage. Please review.
:warning: Please upload report for BASE (develop@2fe9eb7). Learn more about missing BASE report.
| Files with missing lines | Patch % | Lines |
|---|---|---|
| python/paddle/compat/proxy.py | 75.00% | 2 Missing :warning: |
:x: Your patch status has failed because the patch coverage (80.00%) is below the target coverage (90.00%). You can increase the patch coverage or adjust the target coverage.
Additional details and impacted files
@@ Coverage Diff @@
## develop #76823 +/- ##
==========================================
Coverage ? 80.00%
==========================================
Files ? 3
Lines ? 10
Branches ? 0
==========================================
Hits ? 8
Misses ? 2
Partials ? 0
: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.