| 139 | } |
| 140 | |
| 141 | std::unique_ptr<runtime::IVoiceTaskSession> ChatterboxLoadedModel::create_task_session( |
| 142 | const runtime::TaskSpec & task, |
| 143 | const runtime::SessionOptions & options) const { |
| 144 | if (task.task != runtime::VoiceTaskKind::Tts && |
| 145 | task.task != runtime::VoiceTaskKind::VoiceCloning && |
| 146 | task.task != runtime::VoiceTaskKind::VoiceConversion) { |
| 147 | throw std::runtime_error("Chatterbox supports TTS, voice cloning, and voice conversion"); |
| 148 | } |
| 149 | if (task.mode != runtime::RunMode::Offline) { |
| 150 | throw std::runtime_error("Chatterbox only supports offline mode"); |
| 151 | } |
| 152 | return std::make_unique<ChatterboxSession>(task, options, assets_); |
| 153 | } |
| 154 | |
| 155 | std::unique_ptr<ChatterboxLoadedModel> load_chatterbox_model(const std::filesystem::path & model_root) { |
| 156 | auto assets = load_chatterbox_assets(model_root); |
| 157 | |
| 158 | return std::make_unique<ChatterboxLoadedModel>( |
| 159 | metadata(*assets), |
| 160 | capabilities(*assets), |
| 161 | std::move(assets)); |
| 162 | } |
| 163 | |
| 164 | std::shared_ptr<runtime::IVoiceModelLoader> make_chatterbox_loader() { |
| 165 | return std::make_shared<ChatterboxLoader>(); |
| 166 | } |
| 167 | |
| 168 | } // namespace engine::models::chatterbox |
no test coverage detected