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

Function build_band_features

src/models/roformer/runtime.cpp:611–640  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

609 execution_context.backend(),
610 std::max(1, execution_context.config().threads),
611 assets != nullptr ? assets->config.family : std::string("roformer")) {
612 if (assets == nullptr) {
613 throw std::runtime_error("RoFormer graph requires assets");
614 }
615 const auto build_start = Clock::now();
616 const auto & config = assets->config;
617 weights_ = load_mel_band_weights(*assets, execution_context.backend(), execution_context.backend_type(), weight_storage_type);
618
619 init_context(256ull * 1024ull * 1024ull);
620 constants_ = std::make_unique<core::ConstantTensorCache>(
621 backend_,
622 compute_threads_,
623 config.family + ".constants",
624 4ull * 1024ull * 1024ull);
625 auto build_ctx = make_build_context(execution_context, config.family.c_str());
626 constants_->begin_graph();
627 input_shape_ = core::TensorShape::from_dims({1, config.chunk_frames, config.total_band_input_dim});
628 output_shape_ = core::TensorShape::from_dims({1, config.chunk_frames, config.total_band_input_dim});
629
630 auto input = core::make_tensor(build_ctx, GGML_TYPE_F32, input_shape_);
631 input_ = input.tensor;
632
633 const auto time_positions_host = make_positions(config.chunk_frames);
634 const auto time_positions = constants_->make_tensor(
635 core::TensorShape::from_dims({config.chunk_frames}),
636 GGML_TYPE_I32,
637 time_positions_host.data(),
638 time_positions_host.size() * sizeof(int32_t));
639
640 const auto freq_positions_host = make_positions(config.num_bands);
641 const auto freq_positions = constants_->make_tensor(
642 core::TensorShape::from_dims({config.num_bands}),
643 GGML_TYPE_I32,

Callers 1

separate_runtime_chunkFunction · 0.85

Calls 1

sizeMethod · 0.45

Tested by

no test coverage detected