-
Notifications
You must be signed in to change notification settings - Fork 16
Add tree label-synchronous beam-search algorithm #129
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
base: master
Are you sure you want to change the base?
Conversation
…lattice from beam
# Conflicts: # apptainer/2022-10-21_tensorflow-1.15_arm_v1/makefiles/Modules.make # apptainer/2022-10-21_tensorflow-1.15_v1/makefiles/Modules.make # apptainer/2023-05-08_tensorflow-2.8_v1/makefiles/Modules.make # apptainer/2023-08-09_tensorflow-2.8_onnx-1.15_v1/makefiles/Modules.make # apptainer/2023-11-08_tensorflow-2.14_v1/makefiles/Modules.make # apptainer/2025-04-23_tensorflow-2.17_onnx-1.20_v1/makefiles/Modules.make # src/Search/Makefile # src/Search/Module.cc # src/Search/Module.hh
| currentToken(extension.nextToken), | ||
| currentState(extension.state), | ||
| lmHistory(extension.lmHistory), | ||
| length(base.length + 1), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As in LexiconfreeLabelsyncBeamSearch, shouldn't length be incremented depending on the transitionType?
| extension.timeframe + 1, | ||
| {extension.score - extension.lmScore, extension.lmScore}, | ||
| {})); | ||
| break; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe it's better without empty lin betwen case
| } | ||
| break; | ||
|
|
||
| default: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What about LABEL_LOOP?
LexiconfreeLabelsyncBeamSearch also contains blank, should this also include it?
| sentenceEndLemma = lexicon_->specialLemma("sentence-boundary"); | ||
| } | ||
| sentenceEndLabelIndex_ = sentenceEndLemma->id(); | ||
| log() << "Use sentence-end index " << sentenceEndLabelIndex_ << " inferred from lexicon"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also better to have option to read from paramSentenceEndLabelIndex
| Nn::LabelIndex tokenIdx = network_->structure.state(successorState).stateDesc.acousticModel; | ||
|
|
||
| auto transitionType = Nn::LabelScorer::TransitionType::LABEL_TO_LABEL; | ||
| if (hyp.currentToken == Core::Type<Nn::LabelIndex>::max) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| if (hyp.currentToken == Core::Type<Nn::LabelIndex>::max) { | |
| if (hyp.currentToken == Nn::invalidLabelIndex) { |
| } | ||
| }; | ||
|
|
||
| recombinedHypotheses_.clear(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// Reserve capacity because future reallocations would break the raw pointer we are storing later
recombinedHypotheses_.reserve(newBeam_.size());
| break; | ||
|
|
||
| default: | ||
| defect(); // Unexpected transition type which can not be produced by `inferTransitionType` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, why isn't inferTransitionType function defined in this class?
This adds a label-synchronous search algorithm on a search tree built by the AedTreeBuilder (#127).
It is derived from the lexicon-free label-synchronous beam-search algorithm (#126). Similar to the time-synchronous treesearch (#113), global or separate pruning of within-word and word-end hypotheses (within the set of active hypotheses) is possible and a language model score is added a word end.