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

add corrected applicator to linear alignment #407

Merged
merged 11 commits into from
May 11, 2023
3 changes: 2 additions & 1 deletion am/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,8 @@ def get_align_config_and_crp_for_corrected_applicator(
"""
Set the correct type of applicator, default is "legacy". Moreover, set exit penalities to zero
For a given word sequence the exit penalty is constant with respect to the max/sum
:param config:
:param crp:
:param exit_penalty:
christophmluscher marked this conversation as resolved.
Show resolved Hide resolved
:return:
"""

Expand Down
14 changes: 14 additions & 0 deletions mm/mixtures.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
Path = setup_path(__package__)

from .flow import linear_segmentation_flow, cached_alignment_flow
import i6_core.am as am
import i6_core.rasr as rasr
import i6_core.util as util

Expand Down Expand Up @@ -147,6 +148,8 @@ def hash(cls, kwargs):


class LinearAlignmentJob(MergeMixturesJob):
__sis_hash_exclude__ = {"use_corrected_applicator": False}

def __init__(
self,
crp,
Expand All @@ -158,6 +161,8 @@ def __init__(
minimum_speech_proportion=0.7,
save_alignment=False,
keep_accumulators=False,
use_corrected_applicator: bool = False,
exit_penalty_for_corrected_applicator: float = 0.0,
extra_merge_args=None,
extra_config=None,
extra_post_config=None,
Expand Down Expand Up @@ -247,10 +252,19 @@ def create_config(
penalty,
minimum_speech_proportion,
save_alignment,
use_corrected_applicator,
exit_penalty_for_corrected_applicator,
extra_config,
extra_post_config,
**kwargs,
):
if use_corrected_applicator:
crp, _extra_config = am.get_align_config_and_crp_for_corrected_applicator(
crp=crp,
exit_penalty=exit_penalty_for_corrected_applicator,
)
extra_config._update(_extra_config)

segmentation_flow = cls.create_flow(feature_energy_flow, save_alignment)
mapping = {
"corpus": "acoustic-model-trainer.corpus",
Expand Down