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

Method resolve_graph_capacity_config

src/models/pocket_tts/session.cpp:551–640  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

549 static_cast<int64_t>(cached_voice_states_.capacity()));
550 engine::debug::trace_log_scalar(
551 "pocket_tts.voice_state.cache_entries",
552 static_cast<int64_t>(cached_voice_states_.size()));
553 engine::debug::trace_log_scalar("pocket_tts.voice_state.cache_evicted", will_evict ? 1 : 0);
554 return prepared.acoustic_state;
555}
556
557PocketTTSGraphCapacityConfig PocketTTSSession::resolve_graph_capacity_config() const {
558 const runtime::GraphCapacityMode default_mode = core::requested_backend_uses_host_graph_plan(options().backend)
559 ? runtime::GraphCapacityMode::Tiered
560 : runtime::GraphCapacityMode::Double;
561 const auto mode = runtime::resolve_graph_capacity_mode(
562 options(),
563 default_mode,
564 {"offline_graph_capacity_mode", "graph_capacity_mode"});
565 PocketTTSGraphCapacityConfig config;
566 config.prompt_mode = mode;
567 config.generation_mode = mode;
568 config.prompt_capacity = runtime::parse_positive_i64_option(
569 options().options,
570 {"pocket_tts.prompt_graph_capacity"},
571 0);
572 const int64_t generation_capacity = runtime::parse_positive_i64_option(
573 options().options,
574 {"pocket_tts.generation_graph_capacity"},
575 0);
576 if (generation_capacity > std::numeric_limits<int>::max()) {
577 throw std::runtime_error("pocket_tts.generation_graph_capacity exceeds int range");
578 }
579 config.generation_capacity = static_cast<int>(generation_capacity);
580
581 const int64_t weight_context_mb = runtime::parse_positive_i64_option(
582 options().options,
583 {"pocket_tts.weight_context_mb"},
584 64);
585 config.flow_weight_context_bytes = static_cast<size_t>(runtime::parse_positive_i64_option(
586 options().options,
587 {"pocket_tts.flow_weight_context_mb"},
588 weight_context_mb)) * 1024ull * 1024ull;
589 config.mimi_encoder_weight_context_bytes = static_cast<size_t>(runtime::parse_positive_i64_option(
590 options().options,
591 {"pocket_tts.mimi_encoder_weight_context_mb"},
592 weight_context_mb)) * 1024ull * 1024ull;
593 config.mimi_decoder_weight_context_bytes = static_cast<size_t>(runtime::parse_positive_i64_option(
594 options().options,
595 {"pocket_tts.mimi_decoder_weight_context_mb"},
596 weight_context_mb)) * 1024ull * 1024ull;
597 config.flow_weights_view_context_bytes = static_cast<size_t>(runtime::parse_positive_i64_option(
598 options().options,
599 {"pocket_tts.flow_weights_view_context_mb"},
600 256)) * 1024ull * 1024ull;
601 config.flow_step_graph_context_bytes = static_cast<size_t>(runtime::parse_positive_i64_option(
602 options().options,
603 {"pocket_tts.flow_step_graph_context_mb"},
604 256)) * 1024ull * 1024ull;
605 config.mimi_encoder_graph_context_bytes = static_cast<size_t>(runtime::parse_positive_i64_option(
606 options().options,
607 {"pocket_tts.mimi_encoder_graph_context_mb"},
608 512)) * 1024ull * 1024ull;

Callers

nothing calls this directly

Calls 9

maxFunction · 0.85
find_optionFunction · 0.85
parse_bool_optionFunction · 0.85

Tested by

no test coverage detected