Skip to content
This repository has been archived by the owner on Oct 13, 2022. It is now read-only.

[WIP] Implement 2nd pass training using 1-best decoding results from the 1st pass network #198

Open
wants to merge 15 commits into
base: master
Choose a base branch
from

Conversation

csukuangfj
Copy link
Collaborator

It implements #106 (comment)

BTW, since it seems this is hard to get to work, if you feel like it you could work on a simpler idea.
In training time we'd take the best-path alignment and using some kind of RNN or masked attention
we'd predict the next label in that best-path. (We'd probably take in the output of the 1st network
as an input to that). The sequence length here is the same as the original sequence length.
In test time the way this would work at least initially, is we'd run this on n-best lists obtained from the
1st-pass decoding and use the scores to decide which of the n-best paths to keep. There are more accurate
decoding methods we could look into later.


The training objf is decreasing and seems to be converging. Will post the decoding results later.


# now x2 is (B, T, F)

x_concat = torch.cat((padded_acoustics, x2), dim=-1)
Copy link
Collaborator Author

@csukuangfj csukuangfj May 18, 2021

Choose a reason for hiding this comment

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

TODO(fangjun): Use cross attention here

  • query: x2
  • key and value: padded_acoustics

and masked self-attention

  • key, query, and value: x2

@@ -0,0 +1,484 @@
#!/usr/bin/env python3
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

common2.py is the same as common.py, except that it has some code supporting
the second pass model. To avoid conflicts with the master, a new file is used.

The same goes for the following xxx2.py files, e.g., lm_rescore2.py, mmi2.py.

import k2


class Nbest(object):
Copy link
Collaborator Author

@csukuangfj csukuangfj Jul 13, 2021

Choose a reason for hiding this comment

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

@danpovey

This file implements the Nbest class proposed in
#232 (comment)
Please have a review if it matches the proposal.

Copy link
Contributor

Choose a reason for hiding this comment

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

That's great! Yes it looks like what I had in mind.
I assume you would separate it from this PR though? Or maybe even submit it to k2? Since there's a lot going on here.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Will move it to k2.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants