refactor moe of positionwise_feed_forward to let us convert onnx success#2726
Open
computervisionlearner wants to merge 1 commit intowenet-e2e:mainfrom
Open
refactor moe of positionwise_feed_forward to let us convert onnx success#2726computervisionlearner wants to merge 1 commit intowenet-e2e:mainfrom
computervisionlearner wants to merge 1 commit intowenet-e2e:mainfrom
Conversation
cccd69f to
ce4798f
Compare
ce4798f to
d74f4d8
Compare
Member
|
有没有单元测试小代码可以验证下两种方式在相同输入下可以得到相同输出?单测代码可以贴到这个PR里 |
|
正好我最近也在研究这个,这种做法会让所有专家都参与推理,让onnx推理速度变慢,不建议采用 |
Author
|
这确实是一个问题,现在onnx对流程控制支持度不够,目前只能这么搞了
Andrew
***@***.***
…---Original---
From: ***@***.***>
Date: Wed, Apr 30, 2025 17:48 PM
To: ***@***.***>;
Cc: ***@***.******@***.***>;
Subject: Re: [wenet-e2e/wenet] refactor moe of positionwise_feed_forward tolet us convert onnx success (PR #2726)
SwingSoulF left a comment (wenet-e2e/wenet#2726)
正好我最近也在研究这个,这种做法会让所有专家都参与推理,让onnx推理速度变慢,不建议采用
[expert(xs_flat) for expert in self.experts]
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you authored the thread.Message ID: ***@***.***>
|
Collaborator
赞同。libtorch支持流控制,这种改动也会导致libtorch推理变慢 |
Collaborator
|
感谢 这部分最近看下 llm moe那边有标准处理方法 大概思思路是 利用one hot 代替 for |
@Mddct 关于moe模型如何转onnx,能否提供一些参考文章呢?期待回复 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
对Moe的实现进行了重构,原来的Moe实现带有python的流程控制,会导致导出onnx失败。修改后的moe实现,通过mask可以让pytorch更好动态追踪expert的选择。