Add --instruction and --seed to tts/generate.py
--instruction passes through to MOSS-TTS's build_user_message (confirmed to work for emotion in earlier testing) so callers can steer per-line delivery. --seed enables reproducible generation, currently the only way to get determinism out of this pipeline since MOSS-TTS/AuK don't use a fixed-seed workflow the way Qwen3 did. Needed for a downstream per-line episode-generation pipeline (character cards + emotion-tagged script lines). Co-Authored-By: Claude Sonnet 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Y1oQ4h4WE4R9KRvMQLr5Ey
This commit is contained in:
1 parent
057e728091
commit
a65532f3b2
1 file changed
+16
@@ -31,6 +31,16 @@ def main() -> None:
|
|||||||
parser.add_argument("--reference", required=True, help="Reference audio path")
|
parser.add_argument("--reference", required=True, help="Reference audio path")
|
||||||
parser.add_argument("--output", required=True, help="Output wav path")
|
parser.add_argument("--output", required=True, help="Output wav path")
|
||||||
parser.add_argument("--language", default="English", help="Language tag")
|
parser.add_argument("--language", default="English", help="Language tag")
|
||||||
|
parser.add_argument(
|
||||||
|
"--instruction", default=None,
|
||||||
|
help='Style/delivery instruction (e.g. "Change the emotion to excited."). '
|
||||||
|
"Undocumented MOSS-TTS field for this checkpoint - confirmed to work for "
|
||||||
|
"emotion in testing, passed through as-is.",
|
||||||
|
)
|
||||||
|
parser.add_argument(
|
||||||
|
"--seed", type=int, default=None,
|
||||||
|
help="Random seed for reproducibility. Unset = nondeterministic.",
|
||||||
|
)
|
||||||
parser.add_argument("--audio_temperature", type=float, default=1.7)
|
parser.add_argument("--audio_temperature", type=float, default=1.7)
|
||||||
parser.add_argument("--audio_top_p", type=float, default=0.8)
|
parser.add_argument("--audio_top_p", type=float, default=0.8)
|
||||||
parser.add_argument("--audio_top_k", type=int, default=25)
|
parser.add_argument("--audio_top_k", type=int, default=25)
|
||||||
@@ -41,6 +51,11 @@ def main() -> None:
|
|||||||
device = "cuda" if torch.cuda.is_available() else "cpu"
|
device = "cuda" if torch.cuda.is_available() else "cpu"
|
||||||
dtype = torch.bfloat16 if device == "cuda" else torch.float32
|
dtype = torch.bfloat16 if device == "cuda" else torch.float32
|
||||||
|
|
||||||
|
if args.seed is not None:
|
||||||
|
torch.manual_seed(args.seed)
|
||||||
|
if device == "cuda":
|
||||||
|
torch.cuda.manual_seed_all(args.seed)
|
||||||
|
|
||||||
torch.backends.cuda.enable_cudnn_sdp(False)
|
torch.backends.cuda.enable_cudnn_sdp(False)
|
||||||
torch.backends.cuda.enable_flash_sdp(True)
|
torch.backends.cuda.enable_flash_sdp(True)
|
||||||
torch.backends.cuda.enable_mem_efficient_sdp(True)
|
torch.backends.cuda.enable_mem_efficient_sdp(True)
|
||||||
@@ -65,6 +80,7 @@ def main() -> None:
|
|||||||
text=args.text,
|
text=args.text,
|
||||||
language=args.language,
|
language=args.language,
|
||||||
reference=[args.reference],
|
reference=[args.reference],
|
||||||
|
instruction=args.instruction,
|
||||||
)
|
)
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user