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

Use new APIs with k2.RaggedTensor #38

Merged
merged 4 commits into from
Sep 8, 2021
Merged

Conversation

csukuangfj
Copy link
Collaborator

Requires k2-fsa/k2#812

k2.RaggedTensor is introduced to replace k2.RaggedInt and k2.RaggedFloat. The code is not backward compatible.
Also, you have to regenerate HLG.pt.

The advantages of usage k2.RaggedTensor are that it is more Pythonic and functions about ragged tensors are easier to discover. (See https://k2-fsa.github.io/k2/python_api/index.html)

@csukuangfj
Copy link
Collaborator Author

csukuangfj commented Sep 8, 2021

I will merge this PR after the following GitHub actions
https://github.com/k2-fsa/k2/actions/runs/1212202055
finishes, which is building the v1.7 wheel for k2.

GitHub actions in icefall needs the latest k2 (v1.7) in order to pass all the checks (tests).

@@ -199,26 +198,25 @@ def get_texts(best_paths: k2.Fsa) -> List[List[int]]:
Returns a list of lists of int, containing the label sequences we
decoded.
"""
if isinstance(best_paths.aux_labels, k2.RaggedInt):
if isinstance(best_paths.aux_labels, k2.RaggedTensor):
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@glynpu

Could you help to update k2 in ESPnet?

https://github.com/espnet/espnet/blob/26902eed11eb0ce143b99d2dbce922f3d1064e35/espnet2/bin/k2_asr_inference.py#L70

needs to be changed since there is no k2.RaggedInt and k2.RaggedFloat
in k2 v1.7.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Also, we have to install k2 v1.7 in ESPnet GitHub actions.

@csukuangfj
Copy link
Collaborator Author

Tests are passed, so merging it.

@csukuangfj csukuangfj merged commit abadc71 into k2-fsa:master Sep 8, 2021
@csukuangfj csukuangfj deleted the ragged-any branch July 28, 2023 02:39
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.

1 participant