| 174 | |
| 175 | |
| 176 | def load_requests(args: argparse.Namespace) -> list[dict[str, Any]]: |
| 177 | if args.request_sequence_json: |
| 178 | payload = json.loads(args.request_sequence_json) |
| 179 | if not isinstance(payload, list): |
| 180 | raise RuntimeError("--request-sequence-json must decode to a list") |
| 181 | return payload |
| 182 | if args.request_json: |
| 183 | payload = json.loads(args.request_json) |
| 184 | if not isinstance(payload, dict): |
| 185 | raise RuntimeError("--request-json must decode to an object") |
| 186 | return [payload] |
| 187 | texts = args.texts or [TEST_CASES[args.case]] |
| 188 | voice_samples = args.voice_samples or [str(path) for path in DEFAULT_VOICES] |
| 189 | return [ |
| 190 | { |
| 191 | "text": text, |
| 192 | "voice_samples": voice_samples, |
| 193 | "max_new_tokens": args.max_new_tokens, |
| 194 | "max_length_times": args.max_length_times, |
| 195 | "ddpm_steps": args.ddpm_steps, |
| 196 | "cfg_scale": args.cfg_scale, |
| 197 | "seed": args.seed, |
| 198 | } |
| 199 | for text in texts |
| 200 | ] |
| 201 | |
| 202 | |
| 203 | def summary_json(audio: np.ndarray, sample_rate: int, wall_ms: float) -> str: |