Spaces:
Runtime error
Runtime error
version update
Browse files30 unmodified lines31323334353637321 unmodified lines35936036136236336436536636736836937037137237337437537637737830 unmodified linesfrom tada.modules.encoder import Encoder, EncoderOutput # noqa: E402from tada.modules.tada import InferenceOptions, TadaForCausalLM # noqa: E402from tada.utils.text import normalize_text as normalize_text_fn # noqa: E402logging.basicConfig(level=logging.INFO)logger = logging.getLogger(__name__)321 unmodified linesaudio_duration = wav.shape[-1] / 24_000# Filter step_logs to only the user's text tokens (skip prompt/system/EOS tokens)all_logs = output.step_logs or []if _model is not None and text:normalized = normalize_text_fn(text) if normalize_text else textn_text_tokens = len(_model.tokenizer.encode(normalized, add_special_tokens=False))n_eos = _model.config.shift_acoustic # num EOS tokens appended# step_logs = [BOS, system_header..., prompt_text..., user_text..., EOS...]# User text tokens are at: [-(n_text_tokens + n_eos) : -n_eos] (or end if no EOS)start = len(all_logs) - n_text_tokens - n_eosend = len(all_logs) - n_eosgenerated_logs = all_logs[max(0, start):end] if start < len(all_logs) else all_logselse:generated_logs = all_logsgenerated_html = _format_step_logs(generated_logs, audio_duration, wall_time)return tmp_path, generated_html30 unmodified lines313233343536321 unmodified lines35835936036136236336430 unmodified linesfrom tada.modules.encoder import Encoder, EncoderOutput # noqa: E402from tada.modules.tada import InferenceOptions, TadaForCausalLM # noqa: E402logging.basicConfig(level=logging.INFO)logger = logging.getLogger(__name__)321 unmodified linesaudio_duration = wav.shape[-1] / 24_000generated_html = _format_step_logs(output.step_logs or [], audio_duration, wall_time)return tmp_path, generated_html
app.py+1-15