quranic-universal-aligner / src /core /space_profile.py
hetchyy's picture
deploy
d9edf34 verified
Raw
History Blame Contribute Delete
1.41 kB
"""The app-owned batch_align profile: this deployment's alignment config.
The SDK ships the BatchAlignProfile schema + params bounds; the VALUES a
deployment runs are consumer config and live here. Derive per-request copies
via ``SPACE.model_copy(deep=True)`` — never mutate the module instance.
Import-light: pulls pydantic params modules only, no torch.
"""
from __future__ import annotations
from functools import lru_cache
@lru_cache(maxsize=1)
def space_profile():
"""The deployment profile (lazy: qua_sdk is boot-installed by app.py)."""
from qua_sdk.components.matching.runtimes.wraparound_params import WraparoundDpParams
from qua_sdk.components.recognition.spec import RecognitionParams
from qua_sdk.components.segmentation.runtimes.recitation_params import (
RecitationSegmenterParams,
)
from qua_sdk.components.timing.runtimes.mfa_params import MfaParams
from qua_sdk.profiles.batch_align import BatchAlignProfile
return BatchAlignProfile(
name="space",
timing="timing.mfa_remote@v1",
segmentation=RecitationSegmenterParams(
cleaning="segmenter_native", min_silence_ms=200, min_speech_ms=750,
pad_left_ms=100, pad_right_ms=100,
),
recognition=RecognitionParams(model="Base"),
matching=WraparoundDpParams(penalize_non_verse_final=True),
timing_params=MfaParams(),
)