| 288 | options, |
| 289 | "chatterbox.weight_type", |
| 290 | engine::assets::TensorStorageType::Native); |
| 291 | validate_chatterbox_weight_storage(storage_type, "chatterbox.weight_type"); |
| 292 | return storage_type; |
| 293 | } |
| 294 | |
| 295 | ChatterboxMultilingualT3Version resolve_multilingual_t3_version(const runtime::SessionOptions & options) { |
| 296 | const auto value = runtime::find_option(options.options, {"chatterbox.multilingual_t3", "multilingual_t3"}) |
| 297 | .value_or("v2"); |
| 298 | if (value == "v2") { |
| 299 | return ChatterboxMultilingualT3Version::V2; |
| 300 | } |
| 301 | if (value == "v3") { |
| 302 | return ChatterboxMultilingualT3Version::V3; |
| 303 | } |
| 304 | throw std::runtime_error("chatterbox.multilingual_t3 must be v2 or v3"); |
| 305 | } |
| 306 | |
| 307 | std::size_t resolve_conditionals_cache_slots(const runtime::SessionOptions & options) { |
| 308 | constexpr int64_t kDefaultConditionalsCacheSlots = 1; |
| 309 | const int64_t slots = runtime::parse_i64_option( |
| 310 | options.options, |
| 311 | {"chatterbox.conditionals_cache_slots", "conditionals_cache_slots"}) |
| 312 | .value_or(kDefaultConditionalsCacheSlots); |
| 313 | if (slots < 0) { |
| 314 | throw std::runtime_error("chatterbox.conditionals_cache_slots must be non-negative"); |
| 315 | } |
| 316 | if (static_cast<std::uint64_t>(slots) > static_cast<std::uint64_t>(std::numeric_limits<std::size_t>::max())) { |
| 317 | throw std::runtime_error("chatterbox.conditionals_cache_slots is too large"); |
| 318 | } |
| 319 | return static_cast<std::size_t>(slots); |
| 320 | } |
| 321 | |
| 322 | std::size_t resolve_vc_reference_cache_slots(const runtime::SessionOptions & options) { |
| 323 | const auto slots = runtime::parse_i64_option( |
| 324 | options.options, |
| 325 | {"chatterbox.vc_reference_cache_slots", "vc_reference_cache_slots"}) |
| 326 | .value_or(1); |
| 327 | if (slots < 0) { |
| 328 | throw std::runtime_error("chatterbox.vc_reference_cache_slots must be non-negative"); |
| 329 | } |
| 330 | return static_cast<std::size_t>(slots); |
| 331 | } |
| 332 | |
| 333 | bool resolve_mem_saver(const runtime::SessionOptions & options) { |
| 334 | if (const auto value = runtime::find_option(options.options, {"chatterbox.mem_saver", "mem_saver"})) { |
| 335 | return runtime::parse_bool_option(*value, "chatterbox.mem_saver"); |
| 336 | } |
| 337 | return false; |
| 338 | } |
| 339 | |
| 340 | } // namespace |
| 341 | |
| 342 | bool ChatterboxAudioBufferEqual::operator()( |
| 343 | const runtime::AudioBuffer & lhs, |
| 344 | const runtime::AudioBuffer & rhs) const { |
no test coverage detected