MCPcopy Create free account
hub / github.com/0xShug0/audio.cpp / PocketTTSSession

Method PocketTTSSession

src/models/pocket_tts/session.cpp:442–486  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

440 request.noise_schedule_path,
441 latent_size);
442 }
443 return acoustic_config;
444}
445
446} // namespace
447
448PocketTTSSession::PocketTTSSession(
449 runtime::TaskSpec task,
450 runtime::SessionOptions options,
451 std::shared_ptr<const PocketTTSAssets> manifest,
452 std::filesystem::path model_dir)
453 : RuntimeSessionBase(options),
454 task_(task),
455 manifest_(std::move(manifest)),
456 model_dir_(std::move(model_dir)),
457 graph_capacity_(resolve_graph_capacity_config()),
458 weights_(load_pocket_tts_backend_weights(
459 *manifest_,
460 execution_context().backend(),
461 execution_context().backend_type(),
462 graph_capacity_.matmul_weight_storage_type,
463 graph_capacity_.conv_weight_storage_type,
464 graph_capacity_.flow_weight_context_bytes,
465 graph_capacity_.mimi_encoder_weight_context_bytes,
466 graph_capacity_.mimi_decoder_weight_context_bytes)),
467 text_conditioner_(make_text_config(*manifest_)),
468 voice_conditioner_(make_flow_config(*manifest_)),
469 acoustic_model_(make_flow_config(*manifest_)),
470 audio_decoder_(make_decoder_config(*manifest_)),
471 cached_voice_states_(resolve_voice_state_cache_slots(this->options())),
472 prompt_capacity_controller_(graph_capacity_.prompt_mode),
473 generation_capacity_controller_(graph_capacity_.generation_mode) {
474 if (task_.task != runtime::VoiceTaskKind::Tts) {
475 throw std::runtime_error("PocketTTS only supports VoiceTaskKind::Tts");
476 }
477 if (task_.mode != runtime::RunMode::Offline) {
478 throw std::runtime_error("PocketTTS only supports offline mode");
479 }
480 if (graph_capacity_.prompt_mode == runtime::GraphCapacityMode::Unsupported
481 || graph_capacity_.generation_mode == runtime::GraphCapacityMode::Unsupported) {
482 throw std::runtime_error("PocketTTS graph capacity mode=unsupported is not implemented");
483 }
484 if (graph_capacity_.prompt_mode == runtime::GraphCapacityMode::Fixed
485 && graph_capacity_.prompt_capacity <= 0) {
486 throw std::runtime_error("PocketTTS fixed prompt graph capacity must be positive");
487 }
488 if (graph_capacity_.generation_mode == runtime::GraphCapacityMode::Fixed
489 && graph_capacity_.generation_capacity <= 0) {

Callers

nothing calls this directly

Calls 7

make_text_configFunction · 0.85
make_flow_configFunction · 0.85
make_decoder_configFunction · 0.85
backendMethod · 0.45
backend_typeMethod · 0.45

Tested by

no test coverage detected