| 224 | } |
| 225 | |
| 226 | HeartMuLaFrameEmbeddingInputs next_frame_embedding_inputs( |
| 227 | const std::vector<int32_t> & frame_tokens, |
| 228 | int64_t batch, |
| 229 | const HeartMuLaConfig & config) { |
| 230 | if (static_cast<int64_t>(frame_tokens.size()) != batch * config.audio_num_codebooks) { |
| 231 | throw std::runtime_error("HeartMuLa next-frame token shape mismatch"); |
| 232 | } |
| 233 | HeartMuLaFrameEmbeddingInputs inputs; |
| 234 | inputs.batch_size = batch; |
| 235 | inputs.steps = 1; |
| 236 | const size_t count = static_cast<size_t>(batch * config.audio_num_codebooks); |
| 237 | inputs.audio_token_ids.assign(count, 0); |
| 238 | inputs.audio_mask.assign(count, 1.0F); |
| 239 | inputs.text_token_ids.assign(static_cast<size_t>(batch), 0); |
| 240 | inputs.text_cond_mask.assign(static_cast<size_t>(batch), 0.0F); |
| 241 | inputs.text_uncond_mask.assign(static_cast<size_t>(batch), 0.0F); |
| 242 | for (int64_t b = 0; b < batch; ++b) { |
| 243 | for (int64_t q = 0; q < config.audio_num_codebooks; ++q) { |
| 244 | const size_t index = static_cast<size_t>(b * config.audio_num_codebooks + q); |
| 245 | inputs.audio_token_ids[index] = |
| 246 | frame_tokens[index] + static_cast<int32_t>(q * config.audio_vocab_size); |
| 247 | } |
| 248 | } |
| 249 | return inputs; |
| 250 | } |
| 251 | |
| 252 | std::vector<float> decoder_prefill_input( |
| 253 | const HeartMuLaBackboneHidden & last_hidden, |
no test coverage detected