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

[runtime] support onnxruntime #135

Merged
merged 11 commits into from
Feb 26, 2023
Merged

Conversation

cdliang11
Copy link
Collaborator

@cdliang11 cdliang11 commented Feb 22, 2023

This PR is about the implementation of runtime, based on onnxruntime(cpu).

  • frontend
  • model inference
  • cosine
  • api (c++)
  • test (performence & speed)

@cdliang11
Copy link
Collaborator Author

speed: RTF $\approx$ 0.05.
performerce: The embedding output of C++version is almost the same as that of infer_onnx. py, as follows:

infer_onnx.py: [-0.21034606 -0.20237485 -0.01685507 -0.16905731 0.2451672 -0.12103995
-0.06709624 0.15179257 -0.01183029 -0.00560475 -0.00935949 0.18696979
...
-0.04565285 0.15265305 -0.03063865 0.23322488 0.0502028 -0.12179998
-0.51316285 -0.17731237 0.24398448 -0.21500054]

c++: [-0.210346 -0.202376 -0.0168558 -0.169057 0.245167 -0.12104
-0.0670943 0.151792 -0.0118308 -0.00560266 -0.0093577 0.186971
...
-0.0456524 0.15265 -0.0306392 0.233224 0.0502027 -0.1218
-0.513165 -0.177315 0.243985 -0.215002]

@cdliang11 cdliang11 marked this pull request as ready for review February 25, 2023 02:01
@cdliang11
Copy link
Collaborator Author

The speaker_api(c++) is related to business, so we don't consider adding this code for now.


namespace wespeaker {

class E2ESPEAKER {
Copy link
Collaborator

Choose a reason for hiding this comment

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

E2eSpeaker, the name convention should be consistent to global code.

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.


class E2ESPEAKER {
public:
explicit E2ESPEAKER(const std::string& model_path,
Copy link
Collaborator

Choose a reason for hiding this comment

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

Typically, we do not add const & for basic types, such as int/float/double.

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.

@robin1001
Copy link
Collaborator

Great job!

@robin1001 robin1001 merged commit 5e5a035 into wenet-e2e:master Feb 26, 2023
@cdliang11 cdliang11 deleted the chengdong-runtime branch February 26, 2023 05:54
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.

2 participants