Skip to content

Conversation

@fictionking
Copy link
Contributor

在自定义产线yml配置文件中使用pipeline_cls属性声明"module.submodule:ClassName"格式的字符串自定义产线类路径即可。注意:此类需使用pip install提前注册到当前python环境中。同时如果要使用paddlex --serve --pipeline运行还需要在自定义产线类所在文件添加create_pipeline_app函数的实现,参考paddlex\inference\serving\basic_serving_pipeline_apps\object_detection.py。

@paddle-bot
Copy link

paddle-bot bot commented Nov 7, 2025

Thanks for your contribution!

@paddle-bot paddle-bot bot added the contributor External developers label Nov 7, 2025
@cuicheng01
Copy link
Collaborator

感谢贡献代码,不过有个注意点,需要将代码提到develop分支上,之后会在适当的时候合入到稳定分支中。
另外,请 @Bobholamovic review该PR。

# 支持"module.submodule:ClassName"格式的字符串导入
if ":" in pipeline_cls:
module_path, class_name = pipeline_cls.rsplit(":", 1)
__import__(module_path, fromlist=[class_name])
Copy link
Member

Choose a reason for hiding this comment

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

建议使用importlib API。此外,此处不做安全性的检查,是否存在注入攻击的风险?

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