| 227 | } |
| 228 | throw std::runtime_error(std::string(option_name) + " currently supports only native, f32, and f16"); |
| 229 | } |
| 230 | |
| 231 | } // namespace |
| 232 | |
| 233 | namespace { |
| 234 | |
| 235 | void validate_generation_request(const GenerationRequest & request) { |
| 236 | if (request.text.empty()) { |
| 237 | throw std::runtime_error("PocketTTS text prompt is required"); |
| 238 | } |
| 239 | if (request.max_steps < 0) { |
| 240 | throw std::runtime_error("PocketTTS max_steps must be non-negative"); |
| 241 | } |
| 242 | if (request.max_tokens <= 0) { |
| 243 | throw std::runtime_error("PocketTTS max_tokens must be positive"); |
| 244 | } |
| 245 | if (request.frames_after_eos < -1) { |
| 246 | throw std::runtime_error("PocketTTS frames_after_eos must be -1 or non-negative"); |
| 247 | } |
| 248 | if (request.temperature <= 0.0F) { |