| 475 | } |
| 476 | |
| 477 | static outetts_version get_tts_version(llama_model *model, json speaker = json::object()) { |
| 478 | if (speaker.contains("version")) { |
| 479 | std::string version = speaker["version"].get<std::string>(); |
| 480 | if (version == "0.2") { |
| 481 | return OUTETTS_V0_2; |
| 482 | } else if (version == "0.3") { |
| 483 | return OUTETTS_V0_3; |
| 484 | } else { |
| 485 | LOG_ERR("%s: Unsupported speaker version '%s'\n", __func__, version.c_str()); |
| 486 | } |
| 487 | } |
| 488 | |
| 489 | // Also could get version from model itself |
| 490 | const char *chat_template = llama_model_chat_template(model, nullptr); |
| 491 | if (chat_template && std::string(chat_template) == "outetts-0.3") { |
| 492 | return OUTETTS_V0_3; |
| 493 | } |
| 494 | |
| 495 | // Use 0.2 as the default version |
| 496 | return OUTETTS_V0_2; |
| 497 | } |
| 498 | |
| 499 | static std::string audio_text_from_speaker(json speaker, const outetts_version tts_version = OUTETTS_V0_2) { |
| 500 | std::string audio_text = "<|text_start|>"; |
no test coverage detected