UncleanCode commited on
Commit
99d6824
·
verified ·
1 Parent(s): 256a3b6

Default back to model pauses, speed 1.0 (listening test); clause mode experimental

Browse files
Files changed (1) hide show
  1. infer.py +5 -5
infer.py CHANGED
@@ -7,9 +7,9 @@ internal-silence cap (0.6 s), 0.6 s between sentences.
7
 
8
  python infer.py --text "<eng>this is dynamic accent,</eng> <pcm>e dey sound nice abi?</pcm>" --seed 0 --out out.wav
9
 
10
- Prosody v2 (default, `--pause_mode clause`): the text is cut at , ; : . ? ! and at language-switch points; each chunk
11
  is generated with the same LM/flow/prompt, its edge silence is trimmed (energy VAD, 30 ms kept), its speech is sped
12
- up pitch-preserving by `--speed` (WSOLA, default 1.05), and chunks are joined with set gaps from the real anchor's pause statistics:
13
  comma/;/: 0.40 s (+-0.05 jitter), sentence end 0.60 s, unpunctuated language switch 0.12 s, with 10 ms fades.
14
  `--pause_mode model --speed 1.0` reproduces the Phase 2 final samples (model-generated pauses, sentence stitching).
15
 
@@ -27,7 +27,7 @@ HERE = os.path.dirname(os.path.abspath(__file__))
27
  LANGS = ["eng", "ibo", "hau", "yor", "pcm"]
28
  L2I = {l: i for i, l in enumerate(LANGS)}
29
  ANCHOR = "waxal_yor_4"
30
- DEFAULT_SPEED = 1.05 # from the speaking-rate measurement (README, "Prosody v2"): median ref/system ratio 1.06
31
 
32
 
33
  # ------------------------------------------------------------------ text front-end (tags -> spans)
@@ -343,7 +343,7 @@ class DynamicAccent:
343
  sp = sp + [0] * 3
344
  return token2wav(self.cosy, sp, *P["flow"])
345
 
346
- def say(self, tagged_text, seed=0, prompt_k=0, stitch=True, pause_mode="clause", speed=1.10, return_info=False):
347
  if pause_mode == "clause":
348
  return self.say_clause(tagged_text, seed, prompt_k, speed, return_info)
349
  w = self.say_model(tagged_text, seed, prompt_k, stitch)
@@ -400,7 +400,7 @@ def main():
400
  ap.add_argument("--dtype", default="auto", choices=["auto", "bf16", "fp16"],
401
  help="LM autocast dtype. Samples were made with bf16; T4 has no bf16, so auto picks fp16 there")
402
  ap.add_argument("--no_stitch", action="store_true", help="generate multi-sentence text in one pass")
403
- ap.add_argument("--pause_mode", default="clause", choices=["clause", "model"],
404
  help="clause: clause-level chunks joined with anchor-matched gaps (default); model: Phase 2 final behaviour")
405
  ap.add_argument("--speed", type=float, default=DEFAULT_SPEED,
406
  help="pitch-preserving tempo factor applied to speech (gaps are kept as set). 1.0 = Phase 2 final pace")
 
7
 
8
  python infer.py --text "<eng>this is dynamic accent,</eng> <pcm>e dey sound nice abi?</pcm>" --seed 0 --out out.wav
9
 
10
+ Prosody v2 (experimental, `--pause_mode clause`; default is `model`): the text is cut at , ; : . ? ! and at language-switch points; each chunk
11
  is generated with the same LM/flow/prompt, its edge silence is trimmed (energy VAD, 30 ms kept), its speech is sped
12
+ up pitch-preserving by `--speed` (WSOLA, default 1.0), and chunks are joined with set gaps from the real anchor's pause statistics:
13
  comma/;/: 0.40 s (+-0.05 jitter), sentence end 0.60 s, unpunctuated language switch 0.12 s, with 10 ms fades.
14
  `--pause_mode model --speed 1.0` reproduces the Phase 2 final samples (model-generated pauses, sentence stitching).
15
 
 
27
  LANGS = ["eng", "ibo", "hau", "yor", "pcm"]
28
  L2I = {l: i for i, l in enumerate(LANGS)}
29
  ANCHOR = "waxal_yor_4"
30
+ DEFAULT_SPEED = 1.0 # user listening test 2026-10-21: original model pauses preferred; clause/1.05 kept as experimental
31
 
32
 
33
  # ------------------------------------------------------------------ text front-end (tags -> spans)
 
343
  sp = sp + [0] * 3
344
  return token2wav(self.cosy, sp, *P["flow"])
345
 
346
+ def say(self, tagged_text, seed=0, prompt_k=0, stitch=True, pause_mode="model", speed=1.0, return_info=False):
347
  if pause_mode == "clause":
348
  return self.say_clause(tagged_text, seed, prompt_k, speed, return_info)
349
  w = self.say_model(tagged_text, seed, prompt_k, stitch)
 
400
  ap.add_argument("--dtype", default="auto", choices=["auto", "bf16", "fp16"],
401
  help="LM autocast dtype. Samples were made with bf16; T4 has no bf16, so auto picks fp16 there")
402
  ap.add_argument("--no_stitch", action="store_true", help="generate multi-sentence text in one pass")
403
+ ap.add_argument("--pause_mode", default="model", choices=["clause", "model"],
404
  help="clause: clause-level chunks joined with anchor-matched gaps (default); model: Phase 2 final behaviour")
405
  ap.add_argument("--speed", type=float, default=DEFAULT_SPEED,
406
  help="pitch-preserving tempo factor applied to speech (gaps are kept as set). 1.0 = Phase 2 final pace")