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

Streaming asr time stamp #146

Merged
merged 6 commits into from
Oct 4, 2022

Conversation

ezerhouni
Copy link
Collaborator

Copy from : #119

@ezerhouni
Copy link
Collaborator Author

@csukuangfj I have this issue when installing :

/sherpa/sherpa/csrc/online_asr.cc:247:29: error: invalid initialization of reference of type ‘const std::vector<int, std::allocator<int> >&’ from expression of type ‘std::vector<std::vector<int, std::allocator<int> > >*’
  247 |                             &all_hyps, &all_num_trailing_blank_frames)

Did you have the fix somewhere or should I take care of it ? (I saw that you made the code)

@csukuangfj
Copy link
Collaborator

I see.

The master code:

StreamingGreedySearch(*model_, encoder_out, batched_decoder_out,
&all_hyps, &all_num_trailing_blank_frames)

Code of this PR

torch::Tensor StreamingGreedySearch(
RnntModel &model, // NOLINT
torch::Tensor encoder_out, torch::Tensor decoder_out,
const std::vector<int32_t> &frame_offset,
std::vector<std::vector<int32_t>> *hyps,
std::vector<int32_t> *num_trailing_blank_frames,
std::vector<std::vector<int32_t>> *timestamps) {


This PR changes the signature of StreamingGreedySearch, so we need to change the places where StreamingGreedySearch is invoked in C++.

@csukuangfj
Copy link
Collaborator

online_asr.cc was added after #119 is created. Please change online_asr.cc accordingly. For now, just pass an empty vector to StreamingGreedySearch from online_asr.cc should be fine.

@ezerhouni
Copy link
Collaborator Author

@csukuangfj FYI, there is also frame_offset to set

@ezerhouni ezerhouni changed the title [WIP] Streaming asr time stamp Streaming asr time stamp Sep 30, 2022
@ezerhouni
Copy link
Collaborator Author

@csukuangfj Can you have a look ? I think the cpp is broken though, I will try to have a look today

@csukuangfj csukuangfj added the cpp label Oct 3, 2022
Copy link
Collaborator

@csukuangfj csukuangfj left a comment

Choose a reason for hiding this comment

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

Looks great to me. Thanks for the help.

@csukuangfj
Copy link
Collaborator

@csukuangfj Can you have a look ? I think the cpp is broken though, I will try to have a look today

It is just a dummy implementation for the OnlineAsr, but I compiles, I think. What do you mean cpp is broken?

@ezerhouni
Copy link
Collaborator Author

@csukuangfj For the frame_offset in cpp, I just pass empty vector so not sure it produce to correct output (but it compiles)

@csukuangfj
Copy link
Collaborator

@csukuangfj For the frame_offset in cpp, I just pass empty vector so not sure it produce to correct output (but it compiles)

The timestamp won't be correct, but it won't affect the recognition results. Since we are not returning the timestamp information in c++, the current dummy implementation should be fine. We can fix it in a separate PR to also return timestamp in c++.

@csukuangfj
Copy link
Collaborator

@ezerhouni
Thanks! I am merging it. We can fix the dummy implementation for c++ api in a separate PR.

@csukuangfj csukuangfj merged commit 0649c8a into k2-fsa:master Oct 4, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants