| 1978 | } |
| 1979 | |
| 1980 | HeartMuLaDecoderPrefillOutput HeartMuLaWeightsRuntime::decoder_prefill_embeddings( |
| 1981 | const std::vector<float> & embeddings, |
| 1982 | int64_t batch_size, |
| 1983 | int64_t steps, |
| 1984 | int64_t codebook_index) const { |
| 1985 | const auto & full_config = assets_->mula_config; |
| 1986 | if (batch_size <= 0 || steps <= 0) { |
| 1987 | throw std::runtime_error("HeartMuLa decoder prefill requires positive batch and step counts"); |
| 1988 | } |
| 1989 | if (steps > full_config.decoder.max_seq_len) { |
| 1990 | throw std::runtime_error("HeartMuLa decoder prefill exceeds model context length"); |
| 1991 | } |
| 1992 | if (codebook_index < 0 || codebook_index >= full_config.audio_num_codebooks - 1) { |
| 1993 | throw std::runtime_error("HeartMuLa decoder prefill codebook index is out of range"); |
| 1994 | } |
| 1995 | if (static_cast<int64_t>(embeddings.size()) != batch_size * steps * full_config.backbone.embed_dim) { |
| 1996 | throw std::runtime_error("HeartMuLa decoder prefill embedding payload size mismatch"); |
| 1997 | } |
| 1998 | if (decoder_prefill_graph_ == nullptr || |
| 1999 | !decoder_prefill_graph_->matches(*this, batch_size, steps)) { |
| 2000 | decoder_prefill_graph_ = std::make_unique<HeartMuLaDecoderPrefillGraph>(*this, batch_size, steps); |
| 2001 | } |
| 2002 | return decoder_prefill_graph_->run(embeddings, codebook_index); |
| 2003 | } |
| 2004 | |
| 2005 | void HeartMuLaWeightsRuntime::reset_decoder_cached_state( |
| 2006 | HeartMuLaDecoderCachedState & state, |
no test coverage detected