Skip to content

[plugin] Custom model_runner/model support #3186

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
Aug 5, 2025

Conversation

lizhenyun01
Copy link
Collaborator

  1. 新增使用plugin注册model时根据需要在config的ARCHITECTURES中添加model的arch注册的功能支持,如果model的arch以”Ernie“开头会被同时注册到config,从而可以走到ernie的tokenizer及前处理逻辑
  2. 支持在安装model_runner的plugin且指定加载plugin的条件下优先使用自定义的model_runner
  3. 插件使用方式:
    默认走原生model&model_runner;
    安装plugin且指定export FD_PLUGINS="model"情况下注册自定义的model(model为自定义的model plugin):
    安装plugin且指定export FD_PLUGINS="model,model_runner"的情况下注册自定义的model并优先加载自定义的model_runner(model_runner为自定义的model_runner plugin)
    安装plugin且不指定FD_PLUGINS,默认加载所有plugin

Copy link

paddle-bot bot commented Aug 4, 2025

Thanks for your contribution!

@gzy19990617
Copy link
Collaborator

LGTM

except:
from fastdeploy.worker.gpu_model_runner import GPUModelRunner as ModelRunner

# ModelRunner = get_model_runner()
Copy link
Collaborator

Choose a reason for hiding this comment

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

log删一下


runner_class = load_model_runner_plugins()

# 创建 runner 实例
Copy link
Collaborator

Choose a reason for hiding this comment

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

注释写英文的好一点


# 创建 runner 实例
if not callable(runner_class):
print("The returned runner constructor is not callable.")
Copy link
Collaborator

Choose a reason for hiding this comment

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

改成assert判断吧,CI中可以加上这个,监控起来这个接口

@@ -1,6 +1,21 @@
# Copyright (c) 2024 PaddlePaddle Authors. All Rights Reserved.
Copy link
Collaborator

Choose a reason for hiding this comment

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

2025

@@ -0,0 +1,27 @@
# Copyright (c) 2024 PaddlePaddle Authors. All Rights Reserved.
Copy link
Collaborator

Choose a reason for hiding this comment

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

2025

@@ -3,13 +3,11 @@
setup(
name="fastdeploy-plugins",
version="0.1",
packages=["fd_add_dummy_model"],
packages=["fd_add_dummy_model", "fd_add_dummy_model_runner"],
Copy link
Collaborator

Choose a reason for hiding this comment

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

这几个文件顺便都加一下copyrights吧

@@ -0,0 +1,12 @@
from fastdeploy.plugins import load_model_runner_plugins
Copy link
Collaborator

Choose a reason for hiding this comment

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

@yuanlehome yuanlehome changed the title [Feature] Custom model infer [plugin] Custom model_runner/model support Aug 5, 2025
@yuanlehome yuanlehome merged commit fe540f6 into PaddlePaddle:develop Aug 5, 2025
11 of 14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants