Skip to content
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

[Speechx] add nnet prob cache && make 2 thread decode work #2769

Merged
merged 9 commits into from
Dec 27, 2022

Conversation

SmileGoat
Copy link
Contributor

PR types

Performance optimization

PR changes

Others

Describe

add nnet prob cache && make 2 thread decode work

@SmileGoat SmileGoat added this to the r1.4.0 milestone Dec 27, 2022
@mergify mergify bot added the Deployment label Dec 27, 2022
@mergify
Copy link

mergify bot commented Dec 27, 2022

This pull request is now in conflict :(

@mergify mergify bot added the conflicts label Dec 27, 2022
@mergify mergify bot removed the conflicts label Dec 27, 2022
const kaldi::Matrix<BaseFloat>& likelihood) {
std::vector<BaseFloat> prob;
prob.resize(likelihood.NumCols());
for (size_t idx = 0; idx < likelihood.NumRows(); ++idx) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

此处是否可以使用 memcpy相关函数 替换 两层 for循环;担心有效率问题

Copy link
Contributor Author

Choose a reason for hiding this comment

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

不可以,Matrix内存非连续,不过后续会去掉kaldi::matrix这种,所以出现这种for的赋值了。

VLOG(2) << "Forward out " << nframes << " decoder frames.";
std::vector<BaseFloat> logprob(vocab_dim);
// remove later.
for (size_t idx = 0; idx < nframes; ++idx) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

和上面类似的问题

Copy link
Contributor Author

Choose a reason for hiding this comment

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

todo remove later,feature 统一后,vector, Vector 等数据holder会统一处理。

Copy link
Collaborator

Choose a reason for hiding this comment

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

ok

// See the License for the specific language governing permissions and
// limitations under the License.

#include "recognizer/u2_recognizer.h"
Copy link
Collaborator

Choose a reason for hiding this comment

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

am 和 graph 双线程解码,例子可以初步这么写;最终还是需要在 recognizer 类上进行封装,比如 ASREngine,该类实例 在启动时 就启动了双线程

target_include_directories(${bin_name} PRIVATE ${pybind11_INCLUDE_DIRS} ${PROJECT_SOURCE_DIR})
target_link_libraries(${bin_name} ${PYTHON_LIBRARIES} ${PADDLE_LINK_FLAGS})
endif()
#if(USING_U2)
Copy link
Collaborator

Choose a reason for hiding this comment

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

为什么注释掉了?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

api一些使用暂时还没有改完全,基本框架通了,只验证了recognizer_main, 等整体改完,在验证这几个_main.

@@ -130,11 +130,11 @@ class U2Recognizer {
return !result_.empty() && !result_[0].sentence.empty();
}


int FrameShiftInMs() const {
Copy link
Collaborator

Choose a reason for hiding this comment

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

这部分逻辑怎么处理?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

等完整后,再实现。

Copy link
Contributor Author

Choose a reason for hiding this comment

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

现在基本框架是通的,很多细节没有修整。

@SmileGoat SmileGoat merged commit 5046d8e into PaddlePaddle:speechx Dec 27, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

3 participants