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

Function codebook_audio_logits

src/models/heartmula/mula.cpp:485–511  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

483 batch_size_(batch_size),
484 steps_(steps) {
485 if (batch_size_ <= 0 || steps_ <= 0) {
486 throw std::runtime_error("HeartMuLa backbone prefill graph shape is invalid");
487 }
488 const auto & config = runtime_->assets().mula_config.backbone;
489 const auto & weights = runtime_->weights();
490 const int64_t head_dim = require_head_dim(config);
491 ggml_init_params params{runtime_->backbone_prefill_graph_arena_bytes(), nullptr, true};
492 ctx_.reset(ggml_init(params));
493 if (ctx_ == nullptr) {
494 throw std::runtime_error("failed to initialize HeartMuLa backbone prefill graph context");
495 }
496 core::ModuleBuildContext ctx{ctx_.get(), "heartmula.backbone.prefill"};
497 auto x = core::make_tensor(
498 ctx,
499 GGML_TYPE_F32,
500 core::TensorShape::from_dims({batch_size_, steps_, config.embed_dim}));
501 input_ = x.tensor;
502 positions_ = ggml_new_tensor_1d(ctx_.get(), GGML_TYPE_I32, steps_);
503 auto positions = core::wrap_tensor(positions_, core::TensorShape::from_dims({steps_}), GGML_TYPE_I32);
504
505 auto & constants = runtime_->backbone_constants();
506 constants.begin_graph();
507 for (const auto & layer : weights.backbone.layers) {
508 auto layer_out = build_heartmula_transformer_layer(
509 ctx,
510 x,
511 positions,
512 layer,
513 config,
514 weights.backbone_rope_factors,

Calls 5

reshape_tensorFunction · 0.85
wrap_tensorFunction · 0.85
ggml_get_rowsFunction · 0.85
buildMethod · 0.45

Tested by

no test coverage detected