Skip to content

[plugin] Custom model_runner/model support - #3186

Merged
yuanlehome merged 6 commits into
PaddlePaddle:developfrom
lizhenyun01:custom_model_infer
Aug 5, 2025
Merged

yuanlehome merged 6 commits into
PaddlePaddle:developfrom
lizhenyun01:custom_model_infer

Conversation

@lizhenyun01

Copy link
Copy Markdown
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

@paddle-bot

paddle-bot Bot commented Aug 4, 2025

Copy link
Copy Markdown

Thanks for your contribution!

@gzy19990617

Copy link
Copy Markdown
Collaborator

LGTM

Comment thread fastdeploy/worker/gpu_worker.py Outdated
except:
from fastdeploy.worker.gpu_model_runner import GPUModelRunner as ModelRunner

# ModelRunner = get_model_runner()

Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

2025

Comment thread test/plugins/setup.py
name="fastdeploy-plugins",
version="0.1",
packages=["fd_add_dummy_model"],
packages=["fd_add_dummy_model", "fd_add_dummy_model_runner"],

Copy link
Copy Markdown
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
Copy Markdown
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
10 of 13 checks passed
xiaoguoguo626807 pushed a commit to xiaoguoguo626807/FastDeploy that referenced this pull request May 7, 2026
* support custom model&&model_runner

* fix merge

* add test && update doc

* fix codestyle

* fix unittest

* load model in rl
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