Skip to content

Conversation

@rsmallblue
Copy link
Collaborator

revise noaux_tc function to get topk_ids and topk_weight

@paddle-bot
Copy link

paddle-bot bot commented Aug 4, 2025

Thanks for your contribution!

auto input_type = scores_with_bias.dtype();
auto place = scores_with_bias.place();
auto group_scores = paddle::empty({num_tokens, n_group}, input_type, place);
auto topk_values = paddle::empty({num_tokens, topk}, input_type, place);
Copy link
Collaborator

Choose a reason for hiding this comment

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

noaux_tc算子能否补充一个单测监控起来这里精度,有一个散op的形式也便于理解和对精度🧐

Copy link
Collaborator

Choose a reason for hiding this comment

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

+1

Comment on lines +34 to +37
try:
from fastdeploy.model_executor.ops.gpu import noaux_tc
except:
logger.warning("import noaux_tc Failed!")
Copy link
Collaborator

Choose a reason for hiding this comment

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

这种import方式从哪里学到的,try的原因是啥

False,
)
if layer.topk_method == "noaux_tc" and gate_out.size > 0:
score, topk_idx, topk_weights = get_moe_scores(
Copy link
Collaborator

Choose a reason for hiding this comment

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

这里的score和topk_weights分别是什么含义,routed_scaling_factor是作用在哪一个上面的。而且上面的返回值不是scores, topk_values, topk_idx。这里解包之后是score, topk_idx, topk_weights

auto input_type = scores_with_bias.dtype();
auto place = scores_with_bias.place();
auto group_scores = paddle::empty({num_tokens, n_group}, input_type, place);
auto topk_values = paddle::empty({num_tokens, topk}, input_type, place);
Copy link
Collaborator

Choose a reason for hiding this comment

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

+1

@Jiang-Jia-Jun Jiang-Jia-Jun merged commit af543b7 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.

5 participants