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

Function validate_session_options

src/models/heartmula/session.cpp:36–63  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

34}
35
36runtime::SessionOptions normalize_session_options(runtime::SessionOptions options) {
37 return runtime::apply_option_v1_compatibility(
38 std::move(options),
39 {
40 {"heartmula.mula_weight_type", "heartmula.generator_weight_type"},
41 {"heartmula.mula_weight_context_mb", "heartmula.generator_weight_context_mb"},
42 {"heartmula.mula_constant_context_mb", "heartmula.generator_constant_context_mb"},
43 {"heartmula.mula_backbone_prefill_graph_arena_mb", "heartmula.backbone_prefill_graph_arena_mb"},
44 {"heartmula.mula_backbone_step_graph_arena_mb", "heartmula.backbone_step_graph_arena_mb"},
45 {"heartmula.mula_decoder_prefill_graph_arena_mb", "heartmula.decoder_prefill_graph_arena_mb"},
46 {"heartmula.mula_decoder_step_graph_arena_mb", "heartmula.decoder_step_graph_arena_mb"},
47 {"heartmula.mula_frame_embedding_graph_arena_mb", "heartmula.frame_embedding_graph_arena_mb"},
48 {"heartmula.codec_flow_estimator_graph_arena_mb", "heartmula.flow_estimator_graph_arena_mb"},
49 {"heartmula.codec_conditioning_graph_arena_mb", "heartmula.conditioning_graph_arena_mb"},
50 {"heartmula.codec_scalar_decoder_graph_arena_mb", "heartmula.scalar_decoder_graph_arena_mb"},
51 },
52 "HeartMuLa");
53}
54
55runtime::SessionOptions require_supported_session_options(
56 runtime::SessionOptions options,
57 const std::shared_ptr<const engine::model_spec::ModelContract> & contract) {
58 options = normalize_session_options(std::move(options));
59 const auto checked_contract = require_contract(contract);
60 runtime::validate_spec_backed_session_options(options, *checked_contract, kFamily, "HeartMuLa");
61 if (options.backend.threads <= 0) {
62 throw std::runtime_error("HeartMuLa requires positive backend thread count");
63 }
64 if (const auto mem_saver = runtime::find_option(options.options, {"heartmula.mem_saver"})) {
65 (void) runtime::parse_bool_option(*mem_saver, "heartmula.mem_saver");
66 }

Callers 1

Calls 3

parse_bool_optionFunction · 0.85
validate_weight_storageFunction · 0.70

Tested by

no test coverage detected