()
| 4003 | str(scenario_dir / "cpp.timing.log"), |
| 4004 | "--output-dir", |
| 4005 | str(scenario_dir / "cpp_audio"), |
| 4006 | ] |
| 4007 | if args.test_noise_file: |
| 4008 | cpp_command.extend(["--noise-file", args.test_noise_file]) |
| 4009 | for option in args.cpp_session_option: |
| 4010 | cpp_command.extend(["--session-option", option]) |
| 4011 | return python_command, cpp_command |
| 4012 | |
| 4013 | |
| 4014 | def build_vibevoice_commands( |
| 4015 | config: dict[str, Any], |
| 4016 | backend: str, |
| 4017 | args: argparse.Namespace, |
| 4018 | scenario_dir: Path, |
| 4019 | requests: list[dict[str, Any]], |
| 4020 | ) -> tuple[list[str], list[str]]: |
| 4021 | request_sequence_json = json.dumps(requests, ensure_ascii=False, separators=(",", ":")) |
| 4022 | model_path = args.model or config["model"] |
| 4023 | python_env = str(config.get("python_conda_env", "qwen3-tts")) |
| 4024 | model_root = Path(model_path) |
| 4025 | if not model_root.is_absolute(): |
| 4026 | model_root = REPO_ROOT / model_root |
| 4027 | model_config = json.loads((model_root / "config.json").read_text(encoding="utf-8")) |
| 4028 | latent_size = int(model_config["acoustic_vae_dim"]) |
| 4029 | decoder_capacity = int(model_config["decoder_config"]["max_position_embeddings"]) |
| 4030 | total_speakers = sum(max(1, len(request.get("voice_samples", []))) for request in requests) |
| 4031 | prompt_noise_count = total_speakers + total_speakers * decoder_capacity * latent_size |
| 4032 | prompt_noise_path = scenario_dir / "shared_prompt_noise.f32" |
| 4033 | prompt_rng = random.Random(args.seed + 17) |
| 4034 | prompt_values = array.array("f", (prompt_rng.gauss(0.0, 1.0) for _ in range(prompt_noise_count))) |
| 4035 | prompt_noise_path.parent.mkdir(parents=True, exist_ok=True) |
| 4036 | with prompt_noise_path.open("wb") as handle: |
| 4037 | prompt_values.tofile(handle) |
| 4038 | prompt_noise_file = str(prompt_noise_path) |
| 4039 | noise_file = args.test_noise_file |
| 4040 | if not noise_file: |
| 4041 | max_new_tokens = max([int(request.get("max_new_tokens", 0)) for request in requests] + [0]) |
| 4042 | if max_new_tokens <= 0: |
| 4043 | max_new_tokens = decoder_capacity |
no test coverage detected