Skip to content

Conversation

lizexu123
Copy link
Collaborator

@lizexu123 lizexu123 commented Oct 10, 2025

支持pooling模型dummy_pooler_run,以及将之前生成式模型预热阶段重构为dummy_sampler_run

Copy link

paddle-bot bot commented Oct 10, 2025

Thanks for your contribution!

Comment on lines +78 to +79
from fastdeploy.engine.pooling_params import PoolingParams
from fastdeploy.engine.tasks import PoolingTask
Copy link
Collaborator

Choose a reason for hiding this comment

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

从 engine import 东西到底层是合理的吗

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

这里是参考vllm做法,它是vllm/tasks,我就放到engine底下了

Comment on lines +61 to +62
class FdModel(Protocol[T_co]):
"""The interface required for all models in FastDeploy."""
Copy link
Collaborator

Choose a reason for hiding this comment

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

哪些类会继承FDModel,和 ModelForCasualLM 是啥关系

Copy link
Collaborator Author

@lizexu123 lizexu123 Oct 11, 2025

Choose a reason for hiding this comment

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

只有FDModelForPooling继承,和ModelForCasualLM没关系,ModelForCasualLM有compute_logits,pooling模型不计算这个

[num_reqs, req_num_tokens],
dtype="int32",
)
model = cast(FdModelForPooling, self.get_model())
Copy link
Collaborator

Choose a reason for hiding this comment

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

同上,FdModelForPooling 和 ModelForCasualLM 关系是什么,一定要cast吗

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

这里是设置一些默认的pooling_type(如果用户不设置),是需要cast的

Comment on lines +1359 to +1360
to_update = model.pooler.get_pooling_updates(task)
to_update.apply(dummy_pooling_params)
Copy link
Collaborator

Choose a reason for hiding this comment

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

to_update 用命名的语意准确吗

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

参考vllm规范实现的

gongshaotian
gongshaotian previously approved these changes Oct 11, 2025
Comment on lines 73 to 75
cumsum = paddle.zeros([n_seq + 1], dtype="int64")
if cumsum.place.is_gpu_place():
cumsum = cumsum.cpu()
Copy link
Collaborator

Choose a reason for hiding this comment

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

这里为啥不直接zeros一个cpu tensor ?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

done


self.attn_backends.append(attn_backend)

def _dummy_pooler_run_task(
Copy link
Collaborator

Choose a reason for hiding this comment

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

为什么不直接实现在_dummy_pooler_run中,而是单独抽出一个_dummy_pooler_run_task ?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

参看vllm规范写的

self.speculative_decoding = self.speculative_method is not None
self.enable_logprob = fd_config.model_config.enable_logprob
self.enable_early_stop = self.fd_config.early_stop_config.enable_early_stop
self.is_pooling_model = self.fd_config.model_config.runner_type == "pooling"
Copy link
Collaborator

Choose a reason for hiding this comment

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

self.is_pooling_model和is_pooling_model是否能去除一个?有都存在的必要性吗?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

去除了is_pooling_model,保留了self.is_pooling_model

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.

3 participants