accentik / configuration_accentik.py
TeraSpace's picture
Update Accentik to audio v3 with opt-in ё placement
daad4bf verified
Raw History Blame Contribute Delete
1.11 kB
"""Configuration for Accentik's parallel Russian vowel-ranking model."""
from copy import deepcopy
from transformers import PreTrainedConfig
class AccentikConfig(PreTrainedConfig):
model_type = "accentik"
def __init__(self, encoder_config=None, context_window=512,
batch_token_budget=8192, release="audio-v3", yo_threshold=0.8, **kwargs):
super().__init__(**kwargs)
self.encoder_config = deepcopy(encoder_config or {})
self.context_window = int(context_window)
self.batch_token_budget = int(batch_token_budget)
self.release = release
self.yo_threshold = float(yo_threshold)
self.restore_yo_default = False
if not 0.0 <= self.yo_threshold <= 1.0:
raise ValueError("yo_threshold must be between zero and one")
if self.context_window < 8 or self.context_window % 8:
raise ValueError("context_window must be a positive multiple of eight")
if self.batch_token_budget < self.context_window:
raise ValueError("batch_token_budget must fit one complete context window")