L0SG commited on
Commit
4a03311
·
1 Parent(s): eab17e0

Tune and harden S2S generation

Browse files
Files changed (2) hide show
  1. README.md +1 -1
  2. app.py +7 -4
README.md CHANGED
@@ -20,7 +20,7 @@ The model selector defaults to the 30B-A3B and can switch to 2B model.
20
 
21
  The demo includes **audio understanding, speech recognition, speech translation, text reasoning, text-to-speech, and speech-to-speech**.
22
 
23
- Reasoning has no separate token cap by default for either model. `Max new tokens` sets a total cap shared by reasoning and the final answer.
24
 
25
  The hosted ZeroGPU runtime uses a prebuilt `mamba-ssm==2.3.2.post1` Blackwell wheel.
26
 
 
20
 
21
  The demo includes **audio understanding, speech recognition, speech translation, text reasoning, text-to-speech, and speech-to-speech**.
22
 
23
+ Reasoning has no separate token cap by default for most tasks. Speech-to-speech defaults to a 1,536-token reasoning budget so the model has room for its final answer. `Max new tokens` sets a total cap shared by reasoning and the final answer.
24
 
25
  The hosted ZeroGPU runtime uses a prebuilt `mamba-ssm==2.3.2.post1` Blackwell wheel.
26
 
app.py CHANGED
@@ -150,7 +150,7 @@ TTS_MAX_NEW_TOKENS = min(
150
  MAX_NEW_TOKENS,
151
  )
152
  S2S_TEXT_MAX_NEW_TOKENS = int(os.environ.get("AUDEX_S2S_TEXT_MAX_NEW_TOKENS", "2048"))
153
- S2S_REASONING_BUDGET = int(os.environ.get("AUDEX_S2S_REASONING_BUDGET", "0"))
154
  S2S_GPU_DURATION_SECONDS = int(os.environ.get("AUDEX_S2S_GPU_DURATION_SECONDS", "120"))
155
  S2S_SPOKEN_MAX_WORDS = 20
156
  S2S_TTS_MAX_NEW_TOKENS = int(os.environ.get("AUDEX_S2S_TTS_MAX_NEW_TOKENS", "2400"))
@@ -1209,8 +1209,10 @@ def _split_sentence_segments(text: str) -> list[str]:
1209
  def _clean_transcription(text: str) -> str:
1210
  text = text.strip()
1211
  quoted = re.fullmatch(
1212
- r"(?is)(?:(?:the\s+)?(?:transcription|transcript)"
1213
- r"(?:\s+(?:is|reads))?\s*:?\s*)?(['\"])(.*)\1[.!]?",
 
 
1214
  text,
1215
  )
1216
  return quoted.group(2).strip() if quoted else text
@@ -1600,7 +1602,8 @@ with gr.Blocks(title="Nemotron-Labs-Audex") as demo:
1600
  gr.Markdown(
1601
  "Task selection restores the official defaults. ASR and AST use "
1602
  "greedy decoding; audio understanding and text reasoning use sampling. "
1603
- "Reasoning has no separate cap unless you set one. TTS uses CFG 2.0; "
 
1604
  "speech-to-speech uses CFG 1.5."
1605
  )
1606
  with gr.Column():
 
150
  MAX_NEW_TOKENS,
151
  )
152
  S2S_TEXT_MAX_NEW_TOKENS = int(os.environ.get("AUDEX_S2S_TEXT_MAX_NEW_TOKENS", "2048"))
153
+ S2S_REASONING_BUDGET = int(os.environ.get("AUDEX_S2S_REASONING_BUDGET", "1536"))
154
  S2S_GPU_DURATION_SECONDS = int(os.environ.get("AUDEX_S2S_GPU_DURATION_SECONDS", "120"))
155
  S2S_SPOKEN_MAX_WORDS = 20
156
  S2S_TTS_MAX_NEW_TOKENS = int(os.environ.get("AUDEX_S2S_TTS_MAX_NEW_TOKENS", "2400"))
 
1209
  def _clean_transcription(text: str) -> str:
1210
  text = text.strip()
1211
  quoted = re.fullmatch(
1212
+ r"(?is)(?:(?:(?:(?:source\s+)?language)\s*:[^.\n]+\.\s*)?"
1213
+ r"(?:(?:the\s+)?(?:transcription|transcript)(?:\s+(?:is|reads))?"
1214
+ r"|(?:the\s+)?(?:spoken\s+)?content\s+of\s+the\s+(?:input\s+)?audio\s+is)"
1215
+ r"\s*:?\s*)?(['\"])(.*)\1[.!]?",
1216
  text,
1217
  )
1218
  return quoted.group(2).strip() if quoted else text
 
1602
  gr.Markdown(
1603
  "Task selection restores the official defaults. ASR and AST use "
1604
  "greedy decoding; audio understanding and text reasoning use sampling. "
1605
+ "Reasoning has no separate cap unless you set one; speech-to-speech "
1606
+ "defaults to a 1,536-token reasoning budget. TTS uses CFG 2.0; "
1607
  "speech-to-speech uses CFG 1.5."
1608
  )
1609
  with gr.Column():